@@ -27,87 +27,101 @@ This crate is 10 to 50 times faster than [`hex`] in encoding and decoding, and
2727100+ times faster than ` libstd ` in formatting.
2828
2929The following benchmarks were ran on an AMD Ryzen 9 7950X, compiled with
30- ` 1.78.0-nightly (2bf78d12d 2024-02-18 ) ` on ` x86_64-unknown-linux-gnu ` .
30+ ` 1.78.0-nightly (a4472498d 2024-02-15 ) ` on ` x86_64-unknown-linux-gnu ` .
3131
3232You can run these benchmarks with
3333` ./benches/bench/gen-data.py && cargo bench --features std ` on a nightly
3434compiler.
3535
3636``` log
37- test decode::const_hex::bench1_32 ... bench: 14 ns/iter (+/- 0)
38- test decode::const_hex::bench2_256 ... bench: 36 ns/iter (+/- 0)
39- test decode::const_hex::bench3_2048 ... bench: 223 ns/iter (+/- 3)
40- test decode::const_hex::bench4_16384 ... bench: 1,607 ns/iter (+/- 26)
41- test decode::const_hex::bench5_262144 ... bench: 25,604 ns/iter (+/- 487)
42- test decode::faster_hex::bench1_32 ... bench: 15 ns/iter (+/- 0)
43- test decode::faster_hex::bench2_256 ... bench: 49 ns/iter (+/- 0)
44- test decode::faster_hex::bench3_2048 ... bench: 241 ns/iter (+/- 2)
45- test decode::faster_hex::bench4_16384 ... bench: 1,753 ns/iter (+/- 28)
46- test decode::faster_hex::bench5_262144 ... bench: 27,650 ns/iter (+/- 481)
47- test decode::hex::bench1_32 ... bench: 94 ns/iter (+/- 5)
48- test decode::hex::bench2_256 ... bench: 690 ns/iter (+/- 13)
49- test decode::hex::bench3_2048 ... bench: 5,282 ns/iter (+/- 322)
50- test decode::hex::bench4_16384 ... bench: 41,557 ns/iter (+/- 2,409)
51- test decode::hex::bench5_262144 ... bench: 1,491,536 ns/iter (+/- 26,706)
52-
53- test decode_to_slice::const_hex::bench1_32 ... bench: 5 ns/iter (+/- 0)
54- test decode_to_slice::const_hex::bench2_256 ... bench: 26 ns/iter (+/- 0)
55- test decode_to_slice::const_hex::bench3_2048 ... bench: 199 ns/iter (+/- 3)
56- test decode_to_slice::const_hex::bench4_16384 ... bench: 1,589 ns/iter (+/- 14)
57- test decode_to_slice::const_hex::bench5_262144 ... bench: 25,425 ns/iter (+/- 560)
58- test decode_to_slice::faster_hex::bench1_32 ... bench: 5 ns/iter (+/- 0)
59- test decode_to_slice::faster_hex::bench2_256 ... bench: 28 ns/iter (+/- 0)
60- test decode_to_slice::faster_hex::bench3_2048 ... bench: 205 ns/iter (+/- 3)
61- test decode_to_slice::faster_hex::bench4_16384 ... bench: 1,633 ns/iter (+/- 23)
62- test decode_to_slice::faster_hex::bench5_262144 ... bench: 25,873 ns/iter (+/- 1,158)
63- test decode_to_slice::hex::bench1_32 ... bench: 35 ns/iter (+/- 1)
64- test decode_to_slice::hex::bench2_256 ... bench: 297 ns/iter (+/- 12)
65- test decode_to_slice::hex::bench3_2048 ... bench: 2,538 ns/iter (+/- 178)
66- test decode_to_slice::hex::bench4_16384 ... bench: 20,496 ns/iter (+/- 1,198)
67- test decode_to_slice::hex::bench5_262144 ... bench: 1,215,996 ns/iter (+/- 12,647)
68-
69- test encode::const_hex::bench1_32 ... bench: 9 ns/iter (+/- 0)
70- test encode::const_hex::bench2_256 ... bench: 29 ns/iter (+/- 0)
71- test encode::const_hex::bench3_2048 ... bench: 96 ns/iter (+/- 2)
72- test encode::const_hex::bench4_16384 ... bench: 641 ns/iter (+/- 8)
73- test encode::const_hex::bench5_262144 ... bench: 10,217 ns/iter (+/- 403)
74- test encode::faster_hex::bench1_32 ... bench: 16 ns/iter (+/- 0)
75- test encode::faster_hex::bench2_256 ... bench: 37 ns/iter (+/- 0)
76- test encode::faster_hex::bench3_2048 ... bench: 101 ns/iter (+/- 2)
77- test encode::faster_hex::bench4_16384 ... bench: 633 ns/iter (+/- 9)
78- test encode::faster_hex::bench5_262144 ... bench: 10,340 ns/iter (+/- 541)
79- test encode::hex::bench1_32 ... bench: 95 ns/iter (+/- 7)
80- test encode::hex::bench2_256 ... bench: 685 ns/iter (+/- 98)
81- test encode::hex::bench3_2048 ... bench: 5,416 ns/iter (+/- 254)
82- test encode::hex::bench4_16384 ... bench: 43,155 ns/iter (+/- 1,980)
83- test encode::hex::bench5_262144 ... bench: 702,371 ns/iter (+/- 73,299)
84-
85- test encode_to_slice::const_hex::bench1_32 ... bench: 1 ns/iter (+/- 0)
86- test encode_to_slice::const_hex::bench2_256 ... bench: 6 ns/iter (+/- 0)
87- test encode_to_slice::const_hex::bench3_2048 ... bench: 51 ns/iter (+/- 0)
88- test encode_to_slice::const_hex::bench4_16384 ... bench: 443 ns/iter (+/- 20)
89- test encode_to_slice::const_hex::bench5_262144 ... bench: 7,009 ns/iter (+/- 269)
90- test encode_to_slice::faster_hex::bench1_32 ... bench: 4 ns/iter (+/- 0)
91- test encode_to_slice::faster_hex::bench2_256 ... bench: 7 ns/iter (+/- 0)
92- test encode_to_slice::faster_hex::bench3_2048 ... bench: 46 ns/iter (+/- 0)
93- test encode_to_slice::faster_hex::bench4_16384 ... bench: 407 ns/iter (+/- 13)
94- test encode_to_slice::faster_hex::bench5_262144 ... bench: 6,196 ns/iter (+/- 167)
95- test encode_to_slice::hex::bench1_32 ... bench: 11 ns/iter (+/- 0)
96- test encode_to_slice::hex::bench2_256 ... bench: 114 ns/iter (+/- 0)
97- test encode_to_slice::hex::bench3_2048 ... bench: 955 ns/iter (+/- 10)
98- test encode_to_slice::hex::bench4_16384 ... bench: 7,721 ns/iter (+/- 70)
99- test encode_to_slice::hex::bench5_262144 ... bench: 122,247 ns/iter (+/- 3,388)
100-
101- test format::const_hex::bench1_32 ... bench: 9 ns/iter (+/- 0)
102- test format::const_hex::bench2_256 ... bench: 23 ns/iter (+/- 2)
103- test format::const_hex::bench3_2048 ... bench: 118 ns/iter (+/- 3)
104- test format::const_hex::bench4_16384 ... bench: 1,133 ns/iter (+/- 15)
105- test format::const_hex::bench5_262144 ... bench: 19,991 ns/iter (+/- 1,012)
106- test format::std::bench1_32 ... bench: 338 ns/iter (+/- 4)
107- test format::std::bench2_256 ... bench: 2,700 ns/iter (+/- 55)
108- test format::std::bench3_2048 ... bench: 21,852 ns/iter (+/- 278)
109- test format::std::bench4_16384 ... bench: 178,010 ns/iter (+/- 1,697)
110- test format::std::bench5_262144 ... bench: 2,865,767 ns/iter (+/- 62,347)
37+ test decode::const_hex::bench1_32b ... bench: 14 ns/iter (+/- 0)
38+ test decode::const_hex::bench2_256b ... bench: 37 ns/iter (+/- 4)
39+ test decode::const_hex::bench3_2k ... bench: 226 ns/iter (+/- 7)
40+ test decode::const_hex::bench4_16k ... bench: 1,636 ns/iter (+/- 13)
41+ test decode::const_hex::bench5_128k ... bench: 12,644 ns/iter (+/- 84)
42+ test decode::const_hex::bench6_1m ... bench: 102,836 ns/iter (+/- 3,236)
43+ test decode::faster_hex::bench1_32b ... bench: 15 ns/iter (+/- 0)
44+ test decode::faster_hex::bench2_256b ... bench: 50 ns/iter (+/- 1)
45+ test decode::faster_hex::bench3_2k ... bench: 244 ns/iter (+/- 4)
46+ test decode::faster_hex::bench4_16k ... bench: 1,782 ns/iter (+/- 31)
47+ test decode::faster_hex::bench5_128k ... bench: 13,745 ns/iter (+/- 66)
48+ test decode::faster_hex::bench6_1m ... bench: 115,126 ns/iter (+/- 1,544)
49+ test decode::hex::bench1_32b ... bench: 101 ns/iter (+/- 6)
50+ test decode::hex::bench2_256b ... bench: 701 ns/iter (+/- 12)
51+ test decode::hex::bench3_2k ... bench: 5,287 ns/iter (+/- 97)
52+ test decode::hex::bench4_16k ... bench: 41,743 ns/iter (+/- 1,420)
53+ test decode::hex::bench5_128k ... bench: 782,327 ns/iter (+/- 18,876)
54+ test decode::hex::bench6_1m ... bench: 6,283,181 ns/iter (+/- 88,813)
55+
56+ test decode_to_slice::const_hex::bench1_32b ... bench: 5 ns/iter (+/- 0)
57+ test decode_to_slice::const_hex::bench2_256b ... bench: 25 ns/iter (+/- 0)
58+ test decode_to_slice::const_hex::bench3_2k ... bench: 201 ns/iter (+/- 3)
59+ test decode_to_slice::const_hex::bench4_16k ... bench: 1,600 ns/iter (+/- 17)
60+ test decode_to_slice::const_hex::bench5_128k ... bench: 12,732 ns/iter (+/- 119)
61+ test decode_to_slice::const_hex::bench6_1m ... bench: 103,414 ns/iter (+/- 2,402)
62+ test decode_to_slice::faster_hex::bench1_32b ... bench: 6 ns/iter (+/- 0)
63+ test decode_to_slice::faster_hex::bench2_256b ... bench: 28 ns/iter (+/- 0)
64+ test decode_to_slice::faster_hex::bench3_2k ... bench: 206 ns/iter (+/- 3)
65+ test decode_to_slice::faster_hex::bench4_16k ... bench: 1,640 ns/iter (+/- 13)
66+ test decode_to_slice::faster_hex::bench5_128k ... bench: 13,065 ns/iter (+/- 92)
67+ test decode_to_slice::faster_hex::bench6_1m ... bench: 105,963 ns/iter (+/- 2,831)
68+ test decode_to_slice::hex::bench1_32b ... bench: 37 ns/iter (+/- 0)
69+ test decode_to_slice::hex::bench2_256b ... bench: 298 ns/iter (+/- 6)
70+ test decode_to_slice::hex::bench3_2k ... bench: 2,552 ns/iter (+/- 27)
71+ test decode_to_slice::hex::bench4_16k ... bench: 20,335 ns/iter (+/- 581)
72+ test decode_to_slice::hex::bench5_128k ... bench: 611,494 ns/iter (+/- 11,531)
73+ test decode_to_slice::hex::bench6_1m ... bench: 4,941,477 ns/iter (+/- 180,172)
74+
75+ test encode::const_hex::bench1_32b ... bench: 10 ns/iter (+/- 0)
76+ test encode::const_hex::bench2_256b ... bench: 27 ns/iter (+/- 0)
77+ test encode::const_hex::bench3_2k ... bench: 97 ns/iter (+/- 0)
78+ test encode::const_hex::bench4_16k ... bench: 644 ns/iter (+/- 8)
79+ test encode::const_hex::bench5_128k ... bench: 4,967 ns/iter (+/- 52)
80+ test encode::const_hex::bench6_1m ... bench: 45,424 ns/iter (+/- 1,922)
81+ test encode::faster_hex::bench1_32b ... bench: 17 ns/iter (+/- 0)
82+ test encode::faster_hex::bench2_256b ... bench: 36 ns/iter (+/- 0)
83+ test encode::faster_hex::bench3_2k ... bench: 95 ns/iter (+/- 1)
84+ test encode::faster_hex::bench4_16k ... bench: 597 ns/iter (+/- 10)
85+ test encode::faster_hex::bench5_128k ... bench: 4,538 ns/iter (+/- 180)
86+ test encode::faster_hex::bench6_1m ... bench: 41,513 ns/iter (+/- 779)
87+ test encode::hex::bench1_32b ... bench: 97 ns/iter (+/- 0)
88+ test encode::hex::bench2_256b ... bench: 694 ns/iter (+/- 4)
89+ test encode::hex::bench3_2k ... bench: 5,476 ns/iter (+/- 28)
90+ test encode::hex::bench4_16k ... bench: 43,617 ns/iter (+/- 215)
91+ test encode::hex::bench5_128k ... bench: 348,646 ns/iter (+/- 1,155)
92+ test encode::hex::bench6_1m ... bench: 2,895,775 ns/iter (+/- 95,699)
93+
94+ test encode_to_slice::const_hex::bench1_32b ... bench: 1 ns/iter (+/- 0)
95+ test encode_to_slice::const_hex::bench2_256b ... bench: 6 ns/iter (+/- 0)
96+ test encode_to_slice::const_hex::bench3_2k ... bench: 59 ns/iter (+/- 0)
97+ test encode_to_slice::const_hex::bench4_16k ... bench: 438 ns/iter (+/- 2)
98+ test encode_to_slice::const_hex::bench5_128k ... bench: 3,414 ns/iter (+/- 10)
99+ test encode_to_slice::const_hex::bench6_1m ... bench: 28,947 ns/iter (+/- 546)
100+ test encode_to_slice::faster_hex::bench1_32b ... bench: 4 ns/iter (+/- 0)
101+ test encode_to_slice::faster_hex::bench2_256b ... bench: 7 ns/iter (+/- 0)
102+ test encode_to_slice::faster_hex::bench3_2k ... bench: 63 ns/iter (+/- 0)
103+ test encode_to_slice::faster_hex::bench4_16k ... bench: 390 ns/iter (+/- 5)
104+ test encode_to_slice::faster_hex::bench5_128k ... bench: 3,012 ns/iter (+/- 22)
105+ test encode_to_slice::faster_hex::bench6_1m ... bench: 26,138 ns/iter (+/- 596)
106+ test encode_to_slice::hex::bench1_32b ... bench: 11 ns/iter (+/- 0)
107+ test encode_to_slice::hex::bench2_256b ... bench: 116 ns/iter (+/- 0)
108+ test encode_to_slice::hex::bench3_2k ... bench: 971 ns/iter (+/- 6)
109+ test encode_to_slice::hex::bench4_16k ... bench: 7,821 ns/iter (+/- 48)
110+ test encode_to_slice::hex::bench5_128k ... bench: 61,907 ns/iter (+/- 377)
111+ test encode_to_slice::hex::bench6_1m ... bench: 499,203 ns/iter (+/- 3,771)
112+
113+ test format::const_hex::bench1_32b ... bench: 10 ns/iter (+/- 1)
114+ test format::const_hex::bench2_256b ... bench: 18 ns/iter (+/- 0)
115+ test format::const_hex::bench3_2k ... bench: 134 ns/iter (+/- 2)
116+ test format::const_hex::bench4_16k ... bench: 1,151 ns/iter (+/- 5)
117+ test format::const_hex::bench5_128k ... bench: 9,298 ns/iter (+/- 83)
118+ test format::const_hex::bench6_1m ... bench: 83,611 ns/iter (+/- 1,530)
119+ test format::std::bench1_32b ... bench: 359 ns/iter (+/- 6)
120+ test format::std::bench2_256b ... bench: 2,773 ns/iter (+/- 44)
121+ test format::std::bench3_2k ... bench: 22,620 ns/iter (+/- 213)
122+ test format::std::bench4_16k ... bench: 183,197 ns/iter (+/- 1,512)
123+ test format::std::bench5_128k ... bench: 1,481,851 ns/iter (+/- 9,791)
124+ test format::std::bench6_1m ... bench: 11,947,054 ns/iter (+/- 132,579)
111125```
112126
113127## Acknowledgements
0 commit comments