({ n, code, value })
| 28 | } |
| 29 | |
| 30 | function 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…