Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Benchmark from "benchmark";
- (async function () {
- const suite = new Benchmark.Suite();
- const module = await import(process.argv[2]);
- for (let testName of Object.keys(module)) {
- const provider = module[testName];
- const testFunction = provider();
- const result = testFunction();
- console.log(`Test ${testName} return (${result})`);
- suite.add(testName, testFunction);
- }
- suite.on('cycle', function (event) {
- console.log(String(event.target));
- });
- suite.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').map('name'));
- });
- suite.run();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement