@@ -60,39 +60,32 @@ Benchmarks
6060==========
6161
6262Cycles per call from perf (` cycles:u ` at a fixed iteration count, minimum of
63- five runs) on Go 1.27.1, Comet Lake i7-10710U, so CPU frequency and thermal
64- throttling drop out. ` asm ` is the amd64 assembly this library used to ship,
65- ` old Go ` the pure Go path other architectures ran, ` new Go ` the current code.
66- ` Sizes ` rows exercise the block loop, ` Branches ` rows the 0 to 16 byte tail,
63+ three runs) on a Comet Lake i7-10710U, so CPU frequency and thermal
64+ throttling drop out. ` asm ` is the amd64 assembly this library shipped through
65+ v1.1.8; the other columns are this code built by that Go release. ` Sizes `
66+ rows exercise the block loop, ` Branches ` rows the 0 to 16 byte tail, and
6767` RandomLengths ` rows draw an xorshift length in [ 0, 64) on every call.
6868
6969```
70- benchmark asm old Go new Go new/asm new/old
71- 128Sizes/8192 4217 4479 4364 +3.5% -2.6%
72- 128Sizes/1024 534 576 557 +4.3% -3.4%
73- 128Sizes/256 140 159 149 +6.8% -6.0%
74- 128Sizes/64 48 52 49 +1.5% -7.1%
75- 128Sizes/32 35 36 34 -2.1% -3.9%
76- 128Branches/16 26 23 26 -1.4% +10.8%
77- 128Branches/13 25 34 21 -14.5% -37.1%
78- 128Branches/7 26 26 21 -18.5% -19.7%
79- 128Branches/3 25 22 21 -16.4% -3.1%
80- 64Sizes/8192 4216 4533 4362 +3.5% -3.8%
81- 64Sizes/32 35 38 34 -3.5% -10.7%
82- 32Sizes/8192 10216 10191 9585 -6.2% -5.9%
83- 32Sizes/64 89 88 76 -13.6% -13.6%
84- 32Sizes/32 50 49 41 -18.1% -18.0%
85- 32Branches/3 15 15 16 +5.6% +5.8%
86- RandomLengths128 110 96 90 -18.1% -5.8%
87- RandomLengths32 95 96 84 -11.6% -12.0%
70+ benchmark asm go1.25 go1.26 go1.27 1.26/asm 1.27/asm
71+ 128Branches/3 25 25 21 21 -16.7% -16.7%
72+ 128Branches/7 26 26 21 21 -18.6% -18.5%
73+ 128Branches/13 25 27 22 22 -12.5% -14.5%
74+ 128Branches/16 27 35 26 26 -1.4% -1.3%
75+ 128Sizes/32 35 46 34 34 -2.3% -2.2%
76+ 128Sizes/64 48 70 48 49 +1.2% +1.2%
77+ 128Sizes/256 140 209 149 149 +6.9% +6.8%
78+ 128Sizes/1024 534 769 567 557 +6.2% +4.3%
79+ 128Sizes/8192 4215 6212 4361 4363 +3.5% +3.5%
80+ 64Sizes/32 35 46 34 34 -3.7% -3.5%
81+ 64Sizes/1024 535 788 575 557 +7.4% +4.1%
82+ 64Sizes/8192 4221 6326 4360 4366 +3.3% +3.4%
83+ 32Branches/3 15 19 16 16 +5.2% +5.6%
84+ 32Sizes/32 50 56 41 41 -18.2% -18.0%
85+ 32Sizes/64 89 97 77 77 -13.6% -13.6%
86+ 32Sizes/256 322 339 296 302 -7.9% -6.2%
87+ 32Sizes/1024 1284 1335 1243 1211 -3.2% -5.7%
88+ 32Sizes/8192 10080 10405 9896 9582 -1.8% -4.9%
89+ RandomLengths128 110 88 91 90 -18.0% -18.2%
90+ RandomLengths32 96 88 83 85 -13.5% -11.4%
8891```
89-
90- Per 16 byte block the assembly is 8.2 cycles and the Go loop 8.5, on both Go
91- 1.26 and 1.27. The loop indexes data[ i: i +16] with a hoisted bound rather than
92- reslicing, which is three fewer instructions per block. Holding the two
93- multipliers in registers instead of constants measured 8.1 on Go 1.27 and 9.3
94- on Go 1.26, the difference being one register name and its REX prefix, so
95- they stay constants. The tail is read out of the input's last 16 bytes with
96- two overlapping loads rather than a switch on its length, which is a jump
97- table and mispredicts on varying key lengths. The 32 bit sum sits on its four
98- cycle per block dependency chain.
0 commit comments