bench.ts 370 B

12345678910111213141516171819202122232425262728
  1. import b from 'benny'
  2. import { plus100 } from '../index'
  3. function add(a: number) {
  4. return a + 100
  5. }
  6. async function run() {
  7. await b.suite(
  8. 'Add 100',
  9. b.add('Native a + 100', () => {
  10. plus100(10)
  11. }),
  12. b.add('JavaScript a + 100', () => {
  13. add(10)
  14. }),
  15. b.cycle(),
  16. b.complete(),
  17. )
  18. }
  19. run().catch((e) => {
  20. console.error(e)
  21. })