Skip to content

Instantly share code, notes, and snippets.

@danielkon96
Last active October 27, 2022 04:59
Show Gist options
  • Save danielkon96/7f445b8e06c47cbe57bbf2fad86c8c34 to your computer and use it in GitHub Desktop.
Save danielkon96/7f445b8e06c47cbe57bbf2fad86c8c34 to your computer and use it in GitHub Desktop.
async function sample_benchmark() {
const benchOptions = {
id: "Suite Name",
log: customLogger,
minIterations: 3
};
const bench = new Bench(benchOptions);
// Benchmark Group 1
bench.group("Group Name 1")
.addAsync(null, 'sleep_async',
async () => {
await sample_function_sleep_async()
},
null);
// Benchmark Group 2
bench.group("Group Name 2")
.add(null, 'math_sqrt',
() => {
sample_function_math_sqrt()
},
null);
// Run our helper function runBenchmark(...)
await runBenchmarks(bench);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment