({ n, encoding, value })
| 33 | } |
| 34 | |
| 35 | function 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…