@@ -3,7 +3,6 @@ import { join } from 'node:path'
33import { fileURLToPath } from 'node:url'
44
55import { Bench } from 'tinybench'
6- import chalk from 'chalk'
76// @ts -expect-error
87import createWasmHasher from 'webpack/lib/util/hash/xxhash64.js'
98// @ts -expect-error
@@ -16,9 +15,11 @@ const FX = readFileSync(join(fileURLToPath(import.meta.url), '..', '..', '..', '
1615
1716const wasmHasher = createWasmHasher ( )
1817
19- const suite = new Bench ( )
18+ const suite = new Bench ( {
19+ name : 'xxh32 without initial seed' ,
20+ } )
2021
21- await suite
22+ suite
2223 . add ( '@node-rs/xxhash h32' , ( ) => {
2324 xxh32 ( FX , 0 )
2425 } )
@@ -28,32 +29,31 @@ await suite
2829 . add ( 'xxhashjs h32' , ( ) => {
2930 xxhashjs . h32 ( FX , 0 ) . toNumber ( )
3031 } )
31- . warmup ( )
32-
33- console . info ( chalk . green ( 'xxh32 without initial seed' ) )
3432
3533await suite . run ( )
3634console . table ( suite . table ( ) )
3735
38- const multiStepSuite = new Bench ( )
36+ const multiStepSuite = new Bench ( {
37+ name : 'xxh32 without initial seed multi step' ,
38+ } )
3939
40- await multiStepSuite
40+ multiStepSuite
4141 . add ( '@node-rs/xxhash h32' , ( ) => {
4242 new Xxh32 ( ) . update ( FX ) . digest ( )
4343 } )
4444 . add ( 'xxhashjs h32' , ( ) => {
4545 xxhashjs . h32 ( ) . update ( FX ) . digest ( ) . toNumber ( )
4646 } )
47- . warmup ( )
4847
4948await multiStepSuite . run ( )
5049
51- console . info ( chalk . green ( 'xxh32 without initial seed multi step' ) )
5250console . table ( multiStepSuite . table ( ) )
5351
54- const xx64Suite = new Bench ( )
52+ const xx64Suite = new Bench ( {
53+ name : 'xxh64 without initial seed' ,
54+ } )
5555
56- await xx64Suite
56+ xx64Suite
5757 . add ( '@node-rs/xxhash 64' , ( ) => {
5858 xxh64 ( FX ) . toString ( 16 )
5959 } )
@@ -67,16 +67,16 @@ await xx64Suite
6767 . add ( 'xxhashjs h64' , ( ) => {
6868 xxhashjs . h64 ( FX , 0 ) . toString ( 16 )
6969 } )
70- . warmup ( )
7170
7271await xx64Suite . run ( )
7372
74- console . info ( chalk . green ( 'xxh64 without initial seed' ) )
7573console . table ( xx64Suite . table ( ) )
7674
77- const multiStepSuite64 = new Bench ( )
75+ const multiStepSuite64 = new Bench ( {
76+ name : 'xxh64 without initial seed multi step' ,
77+ } )
7878
79- await multiStepSuite64
79+ multiStepSuite64
8080 . add ( '@node-rs/xxhash 64' , ( ) => {
8181 new Xxh64 ( ) . update ( FX ) . digest ( ) . toString ( 16 )
8282 } )
@@ -87,9 +87,7 @@ await multiStepSuite64
8787 . add ( 'xxhashjs h64' , ( ) => {
8888 xxhashjs . h64 ( 0 ) . update ( FX ) . digest ( ) . toString ( 16 )
8989 } )
90- . warmup ( )
9190
9291await multiStepSuite64 . run ( )
9392
94- console . info ( chalk . green ( 'xxh64 without initial seed multi step' ) )
9593console . table ( multiStepSuite64 . table ( ) )
0 commit comments