Skip to content

Commit

Permalink
Jmeterbenchmark
Browse files Browse the repository at this point in the history
test jmeter benchmarking

Signed-off-by: ruzell22 <[email protected]>
  • Loading branch information
ruzell22 committed Dec 12, 2023
1 parent fdc247e commit 972dfc1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/jmeter-benchmarking.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ jobs:
- name: Run benchmark
run: cd examples/benchmarkjs && npm install && node bench.js | tee output.txt

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'benchmarkjs'
output-file-path: examples/benchmarkjs/output.txt
# - name: Store benchmark result
# uses: benchmark-action/github-action-benchmark@v1
# with:
# tool: 'benchmarkjs'
# output-file-path: examples/benchmarkjs/output.txt


# - name: Store benchmark result
# uses: benchmark-action/github-action-benchmark@v1
Expand Down
41 changes: 32 additions & 9 deletions examples/benchmarkjs/bench.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
const Benchmark = require('benchmark');
const suite = new Benchmark.Suite();
const { fib } = require('./index');
// const Benchmark = require("benchmark");
var suite = new Benchmark.Suite();

// add tests
suite
.add("fib(10)", () => {
fib(10);
.add("RegExp#test", function () {
/o/.test("Hello World!");
})
.add("fib(20)", () => {
fib(20);
.add("String#indexOf", function () {
"Hello World!".indexOf("o") > -1;
})
.on("cycle", (event) => {
.add("String#match", function () {
!!"Hello World!".match(/o/);
})
// add listeners
.on("cycle", function (event) {
console.log(String(event.target));
})
.run();
.on("complete", function () {
console.log("Fastest is " + this.filter("fastest").map("name"));
})
// run async
.run({ async: true });

// const suite = new Benchmark.Suite();
// const { fib } = require('./index');

// suite
// .add("fib(10)", () => {
// fib(10);
// })
// .add("fib(20)", () => {
// fib(20);
// })
// .on("cycle", (event) => {
// console.log(String(event.target));
// })
// .run();
1 change: 0 additions & 1 deletion examples/benchmarkjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "rhysd <[email protected]> (https://rhysd.github.io/)",
"license": "MIT",
"devDependencies": {
"benchmark": "^2.1.4"
Expand Down

0 comments on commit 972dfc1

Please sign in to comment.