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

Function main

benchmark/util/splice-one.js:11–33  ·  view source on GitHub ↗
({ n, pos, size })

Source from the content-addressed store, hash-verified

9}, { flags: ['--expose-internals'] });
10
11function main({ n, pos, size }) {
12 const { spliceOne } = require('internal/util');
13 const arr = new Array(size);
14 arr.fill('');
15 let index;
16 switch (pos) {
17 case 'end':
18 index = size - 1;
19 break;
20 case 'middle':
21 index = Math.floor(size / 2);
22 break;
23 default: // start
24 index = 0;
25 }
26
27 bench.start();
28 for (let i = 0; i < n; i++) {
29 spliceOne(arr, index);
30 arr.push('');
31 }
32 bench.end(n);
33}

Callers

nothing calls this directly

Calls 6

spliceOneFunction · 0.85
fillMethod · 0.80
requireFunction · 0.50
startMethod · 0.45
pushMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…