(fn)
| 35 | return s.length % 2 ? s[m] : (s[m - 1] + s[m]) / 2; |
| 36 | } |
| 37 | function timeit(fn) { |
| 38 | let t = performance.now(); |
| 39 | fn(); |
| 40 | const first = performance.now() - t; |
| 41 | const iterations = Math.min(50, Math.max(1, Math.round(150 / Math.max(first, 0.01)))); |
| 42 | for (let i = 0; i < Math.min(3, iterations); i++) fn(); |
| 43 | const times = []; |
| 44 | for (let i = 0; i < iterations; i++) { t = performance.now(); fn(); times.push(performance.now() - t); } |
| 45 | return { timeMs: median(times), minMs: Math.min(...times), iterations }; |
| 46 | } |
| 47 | |
| 48 | const mjPath = join(__dirname, '..', '.competitors', 'mathjs-host', 'node_modules', 'mathjs', 'lib', 'esm', 'index.js'); |
| 49 | const math = await import(mjPath); |
no test coverage detected