MCPcopy
hub / github.com/vercel/next.js / run

Function run

bench/recursive-copy/run.js:22–45  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

20}
21
22async function run(fn) {
23 async function test() {
24 const start = process.hrtime()
25
26 await fn(srcDir, destDir)
27
28 const timer = process.hrtime(start)
29 const ms = (timer[0] * 1e9 + timer[1]) / 1e6
30 return ms
31 }
32
33 const ts = []
34
35 for (let i = 0; i < 10; i++) {
36 const t = await test()
37 await remove(destDir)
38 ts.push(t)
39 }
40
41 const sum = ts.reduce((a, b) => a + b)
42 const nb = ts.length
43 const avg = sum / nb
44 console.log({ sum, nb, avg })
45}
46
47async function main() {
48 await createSrcFolder()

Callers 1

mainFunction · 0.70

Calls 5

reduceMethod · 0.80
testFunction · 0.70
pushMethod · 0.65
removeFunction · 0.50
logMethod · 0.45

Tested by

no test coverage detected