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

Function main

benchmark/validators/validate-x-array.js:42–66  ·  view source on GitHub ↗
({ n, type, arrayLength })

Source from the content-addressed store, hash-verified

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

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…