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

Function main

benchmark/validators/validate-one-of.js:43–69  ·  view source on GitHub ↗
({ n, code, validLength })

Source from the content-addressed store, hash-verified

41}
42
43function main({ n, code, validLength }) {
44 const validate = getValidateFactory(code, validLength);
45
46 // Warm up.
47 const length = 1024;
48 const array = [];
49
50 const value = validValues[validLength - 1];
51
52 for (let i = 0; i < length; ++i) {
53 array.push(validate(value));
54 }
55
56 bench.start();
57 for (let i = 0; i < n; ++i) {
58 const index = i % length;
59 array[index] = validate(value);
60 }
61 bench.end(n);
62
63
64 // Verify the entries to prevent dead code elimination from making
65 // the benchmark invalid.
66 for (let i = 0; i < length; ++i) {
67 assert.strictEqual(typeof array[i], 'undefined');
68 }
69}

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…