Skip to content

Commit

Permalink
codspeed: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
CanadaHonk committed Nov 24, 2024
1 parent 65b6d9d commit b023571
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
25 changes: 8 additions & 17 deletions bench/codspeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,16 @@ const bench = withCodSpeed(new Bench());
import { readFileSync } from 'node:fs';
import compile from '../compiler/wrap.js';

const argv = process.argv.slice();

const files = [ 'richards.js' ];
const prefVariants = [ '', '-O0', '--no-coctc' ];
for (const file of files) {
for (const prefs of prefVariants) {
let run;
bench.add((file + ' ' + prefs).trim(), () => {
run();
}, {
beforeEach: () => {
// fresh compile for each run
process.argv = (argv.join(' ') + ' ' + prefs).trim().split(' ');
globalThis.argvChanged();

run = compile(readFileSync('bench/' + file, 'utf8')).exports.main;
}
});
}
let run;
bench.add(file, () => {
run();
}, {
beforeEach: () => {
run = compile(readFileSync('bench/' + file, 'utf8')).exports.main;
}
});
}

await bench.run();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "porffor",
"description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
"version": "0.50.8",
"version": "0.50.9",
"author": "CanadaHonk",
"license": "MIT",
"scripts": {},
Expand Down
2 changes: 1 addition & 1 deletion runner/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import fs from 'node:fs';
globalThis.version = '0.50.8';
globalThis.version = '0.50.9';

// deno compat
if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
Expand Down

0 comments on commit b023571

Please sign in to comment.