string-array-to-hex-stripped.mjs 819 B

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