MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / benchmark

Function benchmark

benchmarks/numeric-evaluation.ts:5–12  ·  view source on GitHub ↗
(name: string, fn: () => void, iterations: number = 1)

Source from the content-addressed store, hash-verified

3const ce = new ComputeEngine();
4
5function benchmark(name: string, fn: () => void, iterations: number = 1) {
6 const start = performance.now();
7 for (let i = 0; i < iterations; i++) {
8 fn();
9 }
10 const end = performance.now();
11 console.log(`${name}: ${((end - start) / iterations).toFixed(2)}ms`);
12}
13
14console.log('--- Numerical Evaluation Benchmarks ---');
15

Callers 1

Calls 3

fnFunction · 0.85
toFixedMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected