Skip to content

Commit ea9b3e3

Browse files
committed
Jmeterbenchmark
test jmeter benchmarking Signed-off-by: ruzell22 <[email protected]>
1 parent 1fb2551 commit ea9b3e3

File tree

5 files changed

+99
-0
lines changed

5 files changed

+99
-0
lines changed
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Benchmark.js Example
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: write
12+
deployments: write
13+
14+
jobs:
15+
benchmark:
16+
name: Run JavaScript benchmark example
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: actions/setup-node@v1
21+
- name: Run benchmark
22+
run: cd packages/cactus-plugin-ledger-connector-besu/src/test/benchmarkjs && npm install && node bench.js | tee output.txt
23+
24+
- name: Commit changes
25+
run: |
26+
git add packages/cactus-plugin-ledger-connector-besu/src/test/benchmarkjs/package.json
27+
git commit -s -m "Committing changes to package.json"
28+
if: github.event_name == 'push'
29+
30+
- name: Stash changes
31+
run: git stash
32+
if: github.event_name == 'pull_request'
33+
34+
- name: Store benchmark result
35+
uses: benchmark-action/github-action-benchmark@v1
36+
with:
37+
tool: 'benchmarkjs'
38+
output-file-path: packages/cactus-plugin-ledger-connector-besu/src/test/benchmarkjs/output.txt
39+
github-token: ${{ secrets.GITHUB_TOKEN }}
40+
auto-push: true
41+
# Show alert with commit comment on detecting possible performance regression
42+
alert-threshold: '200%'
43+
comment-on-alert: true
44+
fail-on-alert: true
45+
46+
# - name: Store benchmark result - separate results repo
47+
# uses: benchmark-action/github-action-benchmark@v1
48+
# with:
49+
# name: Benchmark.js Benchmark
50+
# tool: 'benchmarkjs'
51+
# output-file-path: packages/cactus-plugin-ledger-connector-besu/src/test/benchmarkjs/output.txt
52+
# github-token: ${{ secrets.BENCHMARK_ACTION_BOT_TOKEN }}
53+
# auto-push: true
54+
# # Show alert with commit comment on detecting possible performance regression
55+
# alert-threshold: '200%'
56+
# comment-on-alert: true
57+
# fail-on-alert: true
58+
# gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules
2+
/package-lock.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const Benchmark = require('benchmark');
2+
const suite = new Benchmark.Suite();
3+
const { exec } = require('child_process');
4+
const benchmarkBesu = "benchmark-besu";
5+
6+
suite
7+
exec(`npm run ${benchmarkBesu}`, (error, stdout) => {
8+
if (error) {
9+
console.error();
10+
return;
11+
}
12+
13+
on("cycle", (event) => {
14+
console.log(String(event.target));
15+
})
16+
.run();
17+
18+
// console.log(`Script output:\n${stdout}`);
19+
});
20+
21+
// suite
22+
// .add("fib(10)", () => {
23+
// fib(10);
24+
// })
25+
// .add("fib(20)", () => {
26+
// fib(20);
27+
// })
28+
// .on("cycle", (event) => {
29+
// console.log(String(event.target));
30+
// })
31+
// .run();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function fib(n) {
2+
if (n <= 1) {
3+
return 1;
4+
}
5+
return fib(n - 2) + fib(n - 1);
6+
}
7+
8+
exports.fib = fib;

packages/cactus-plugin-ledger-connector-besu/src/test/benchmarkjs/package.json

Whitespace-only changes.

0 commit comments

Comments
 (0)