MCPcopy Index your code
hub / github.com/nodejs/node / main

Function main

benchmark/validators/validate-boolean.js:30–55  ·  view source on GitHub ↗
({ n, code, value })

Source from the content-addressed store, hash-verified

28}
29
30function main({ n, code, value }) {
31 const validate = getValidateFactory(code);
32 const v = value === 'true';
33
34 // Warm up.
35 const length = 1024;
36 const array = [];
37 for (let i = 0; i < length; ++i) {
38 array.push(validate(v));
39 }
40
41 bench.start();
42
43 for (let i = 0; i < n; ++i) {
44 const index = i % length;
45 array[index] = validate(v);
46 }
47
48 bench.end(n);
49
50 // Verify the entries to prevent dead code elimination from making
51 // the benchmark invalid.
52 for (let i = 0; i < length; ++i) {
53 assert.strictEqual(typeof array[i], 'undefined');
54 }
55}

Callers

nothing calls this directly

Calls 5

getValidateFactoryFunction · 0.70
validateFunction · 0.50
pushMethod · 0.45
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…