| 1 |
import { Bench } from 'tinybench' |
| 2 |
import { stringArrayToHexStripped } from '../lib/utils.js' |
| 3 |
|
| 4 |
const benchStringArrayToHexStripped = new Bench({ name: 'stringArrayToHexStripped' }) |
| 5 |
|
| 6 |
const case1 = ['0', '0', '0', '0'] |
| 7 |
const case2 = ['0', '0', '0', '1'] |
| 8 |
const case3 = ['0', '0', '1', '0'] |
| 9 |
const case4 = ['0', '1', '0', '0'] |
| 10 |
const case5 = ['1', '0', '0', '0'] |
| 11 |
const case6 = ['1', '0', '0', '1'] |
| 12 |
|
| 13 |
benchStringArrayToHexStripped.add('stringArrayToHexStripped', function () { |
| 14 |
stringArrayToHexStripped(case1) |
| 15 |
stringArrayToHexStripped(case2) |
| 16 |
stringArrayToHexStripped(case3) |
| 17 |
stringArrayToHexStripped(case4) |
| 18 |
stringArrayToHexStripped(case5) |
| 19 |
stringArrayToHexStripped(case6) |
| 20 |
}) |
| 21 |
|
| 22 |
await benchStringArrayToHexStripped.run() |
| 23 |
console.log(benchStringArrayToHexStripped.name) |
| 24 |
console.table(benchStringArrayToHexStripped.table()) |