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

Function main

benchmark/validators/validate-encoding.js:35–59  ·  view source on GitHub ↗
({ n, encoding, value })

Source from the content-addressed store, hash-verified

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

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…