11import { Bench } from 'tinybench'
2- import chalk from 'chalk'
32import { crc32 as crc32Node } from 'crc'
43import Sse4Crc32 from 'sse4_crc32'
54
@@ -26,66 +25,66 @@ const initialCrc32c = Sse4Crc32.calculate(TEST_BUFFER)
2625console . assert ( crc32 ( TEST_BUFFER ) === initialCrc32 )
2726console . assert ( crc32c ( TEST_BUFFER ) === initialCrc32c )
2827
29- const suite = new Bench ( )
28+ const suite = new Bench ( {
29+ name : 'crc32c without initial crc' ,
30+ } )
3031
31- await suite
32+ suite
3233 . add ( '@node/rs crc32c' , ( ) => {
3334 crc32c ( TEST_BUFFER )
3435 } )
3536 . add ( 'sse4_crc32' , ( ) => {
3637 Sse4Crc32 . calculate ( TEST_BUFFER )
3738 } )
38- . warmup ( )
3939
4040await suite . run ( )
4141
42- console . info ( chalk . green ( 'crc32c without initial crc' ) )
4342console . table ( suite . table ( ) )
4443
45- const suite2 = new Bench ( )
44+ const suite2 = new Bench ( {
45+ name : 'crc32c with initial crc' ,
46+ } )
4647
47- await suite2
48+ suite2
4849 . add ( '@node/rs crc32c' , ( ) => {
4950 crc32c ( TEST_BUFFER , initialCrc32c )
5051 } )
5152 . add ( 'sse4_crc32' , ( ) => {
5253 Sse4Crc32 . calculate ( TEST_BUFFER , initialCrc32c )
5354 } )
54- . warmup ( )
5555
5656await suite2 . run ( )
5757
58- console . info ( chalk . green ( 'crc32c with initial crc' ) )
5958console . table ( suite2 . table ( ) )
6059
61- const suite3 = new Bench ( )
60+ const suite3 = new Bench ( {
61+ name : 'crc32 without initial crc' ,
62+ } )
6263
63- await suite3
64+ suite3
6465 . add ( '@node/rs crc32' , ( ) => {
6566 crc32 ( TEST_BUFFER )
6667 } )
6768 . add ( 'Node crc' , ( ) => {
6869 crc32Node ( TEST_BUFFER )
6970 } )
70- . warmup ( )
7171
7272await suite3 . run ( )
7373
74- console . info ( chalk . green ( 'crc32 without initial crc' ) )
7574console . table ( suite3 . table ( ) )
7675
77- const suite4 = new Bench ( )
76+ const suite4 = new Bench ( {
77+ name : 'crc32 with initial crc' ,
78+ } )
7879
79- await suite4
80+ suite4
8081 . add ( '@node/rs crc32' , ( ) => {
8182 crc32 ( TEST_BUFFER , initialCrc32 )
8283 } )
8384 . add ( 'Node crc32' , ( ) => {
8485 crc32Node ( TEST_BUFFER , initialCrc32 )
8586 } )
86- . warmup ( )
8787
8888await suite4 . run ( )
8989
90- console . info ( chalk . green ( 'crc32 with initial crc' ) )
9190console . table ( suite4 . table ( ) )
0 commit comments