MCPcopy Create free account
hub / github.com/Rich-Harris/magic-string / runWithInstance

Function runWithInstance

benchmark/index.mjs:35–52  ·  view source on GitHub ↗
(name, inputs, func, setup)

Source from the content-addressed store, hash-verified

33}
34
35function runWithInstance(name, inputs, func, setup) {
36 const ss = []
37 return run(name, {
38 setup: () => {
39 for (const [i, input] of inputs.entries()) {
40 ss[i] = new MagicString(input)
41 if (setup) {
42 setup(ss[i])
43 }
44 }
45 },
46 fn: () => {
47 for (const i of inputs.keys()) {
48 func(ss[i])
49 }
50 },
51 })
52}
53
54function printResults() {
55 if (isTTY) {

Callers 1

benchFunction · 0.85

Calls 1

runFunction · 0.85

Tested by

no test coverage detected