Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaydubina committed Jun 15, 2024
1 parent 3b6f0d5 commit 92e86de
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 72 deletions.
2 changes: 1 addition & 1 deletion 05-03_counting_zeros_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func BenchmarkLeadingZeros(b *testing.B) {
f func(x uint64) uint8
}{
{"basic", leadingZeros64},
{"LeadingZerosUint32", hd.LeadingZerosUint64},
{"LeadingZerosUint64", hd.LeadingZerosUint64},
}
for _, v := range vs {
b.Run(v.name, func(b *testing.B) {
Expand Down
2 changes: 0 additions & 2 deletions 07-04_compress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ func BenchmarkCompress(b *testing.B) {
}

b.Run("Compress", func(b *testing.B) {
b.ResetTimer()
var v uint32
for n := 0; n < b.N; n++ {
v = hd.Compress(vs[n%len(vs)], vs[(n+1)%len(vs)])
Expand All @@ -68,7 +67,6 @@ func BenchmarkCompress(b *testing.B) {
})

b.Run("Compress2", func(b *testing.B) {
b.ResetTimer()
var v uint32
for n := 0; n < b.N; n++ {
v = hd.Compress2(vs[n%len(vs)], vs[(n+1)%len(vs)])
Expand Down
2 changes: 1 addition & 1 deletion 07-09_lru_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func BenchmarkLRU(b *testing.B) {
}
}{
{"basic", NewLRUCacheBasic()},
{"LeadingZerosUint32", &hd.LRUCache{}},
{"LRUCache", &hd.LRUCache{}},
}
for _, v := range vs {
b.Run(v.name, func(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion 17-00_floating_point_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func BenchmarkRSqrtFloat32(b *testing.B) {
f func(x float32) float32
}{
{"basic", basicRSqrt},
{"CRC32Basic", hd.RSqrtFloat32},
{"RSqrtFloat32", hd.RSqrtFloat32},
}
for _, v := range vs {
b.Run(v.name, func(b *testing.B) {
Expand Down
134 changes: 67 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,75 +49,75 @@ goos: darwin
goarch: arm64
pkg: github.com/nikolaydubina/go-hackers-delight
BenchmarkNoop/---------------------------------16 1000000000 0.0000001 ns/op
BenchmarkAbs/basic-16 1000000000 0.9330 ns/op
BenchmarkAbs/Abs-16 1000000000 0.9326 ns/op
BenchmarkAbs/Abs2-16 1000000000 0.9362 ns/op
BenchmarkAbs/Abs3-16 1000000000 0.9324 ns/op
BenchmarkAbs/Abs4-16 1000000000 0.9414 ns/op
BenchmarkAbs/AbsFastMul-16 1000000000 0.9493 ns/op
BenchmarkAvg/basic-16 590327602 2.045 ns/op
BenchmarkAvg/AvgFloor-16 594028404 2.004 ns/op
BenchmarkAvg/AvgCeil-16 592978882 2.020 ns/op
BenchmarkCycleThree/basic-16 787989288 1.519 ns/op
BenchmarkCycleThree/CycleThreeValues-16 474497178 2.510 ns/op
BenchmarkLeadingZeros/uint32/basic-16 1000000000 0.9270 ns/op
BenchmarkLeadingZeros/uint32/LeadingZerosUint32-16 1000000000 1.136 ns/op
BenchmarkLeadingZeros/uint64/basic-16 1000000000 1.099 ns/op
BenchmarkLeadingZeros/uint64/LeadingZerosUint32-16 877795342 1.512 ns/op
BenchmarkCompress/Compress-16 100000000 10.77 ns/op
BenchmarkCompress/Compress2-16 58750090 21.02 ns/op
BenchmarkLRU/basic-16 239493868 4.978 ns/op
BenchmarkLRU/LeadingZerosUint32-16 981022663 1.223 ns/op
BenchmarkMul/uint32/basic-16 656605255 2.006 ns/op
BenchmarkMul/uint32/MultiplyHighOrder32-16 591757071 1.743 ns/op
BenchmarkMul/uint64/basic-16 993127761 1.207 ns/op
BenchmarkMul/uint64/MultiplyHighOrder64-16 975349400 2.025 ns/op
BenchmarkDivMod/DivMod/3/basic-16 1000000000 0.8625 ns/op
BenchmarkDivMod/DivMod/3/DivMod3Signed-16 607501119 1.970 ns/op
BenchmarkDivMod/DivMod/3/DivMod3Signed2-16 1000000000 1.117 ns/op
BenchmarkDivMod/DivMod/7/basic-16 1000000000 0.8537 ns/op
BenchmarkDivMod/DivMod/7/DivMod7Signed-16 562010763 2.144 ns/op
BenchmarkDivMod/Div/3/basic-16 1000000000 0.8432 ns/op
BenchmarkDivMod/Div/3/Div3Signed-16 794080347 1.528 ns/op
BenchmarkDivMod/Div/3/Div3ShiftSigned-16 892143838 1.332 ns/op
BenchmarkDivMod/Div/7/basic-16 1000000000 0.8831 ns/op
BenchmarkDivMod/Div/7/Div7Signed-16 725504583 1.657 ns/op
BenchmarkDivMod/Div/7/Div7ShiftSigned-16 828426534 1.443 ns/op
BenchmarkDivMod/Mod/3/basic-16 1000000000 0.8523 ns/op
BenchmarkDivMod/Mod/3/Mod3Signed-16 780382692 1.518 ns/op
BenchmarkDivMod/Mod/3/Mod3Signed2-16 1000000000 0.8461 ns/op
BenchmarkDivMod/Mod/7/basic-16 1000000000 0.8449 ns/op
BenchmarkDivMod/Mod/7/Mod7Signed-16 747462322 1.631 ns/op
BenchmarkDivMod/Mod/7/Mod7Signed2-16 1000000000 1.100 ns/op
BenchmarkDivMod/Mod/10/basic-16 1000000000 0.8332 ns/op
BenchmarkDivMod/Mod/10/Mod10Signed-16 815590462 1.436 ns/op
BenchmarkDivMod/DivExact/7/basic-16 1000000000 0.9324 ns/op
BenchmarkDivMod/DivExact/7/DivExact7-16 1000000000 0.9513 ns/op
BenchmarkDivMod/DivExact/7/Div7Signed-16 698338923 1.695 ns/op
BenchmarkDivMod/DivExact/7/Div7ShiftSigned-16 802803792 1.504 ns/op
BenchmarkCbrt/basic-16 46489705 26.13 ns/op
BenchmarkCbrt/Cbrt-16 82498086 15.14 ns/op
BenchmarkPow/basic-16 22573610 51.55 ns/op
BenchmarkPow/Pow-16 62801604 19.12 ns/op
BenchmarkLog/uint32/2/basic-16 100000000 11.93 ns/op
BenchmarkLog/uint32/2/Log2-16 977360526 1.228 ns/op
BenchmarkLog/uint32/10/basic-16 139321425 8.559 ns/op
BenchmarkLog/uint32/10/Log10-16 539884531 2.237 ns/op
BenchmarkLog/uint64/2/basic-16 100000000 11.75 ns/op
BenchmarkLog/uint64/2/Log2-16 845898448 1.419 ns/op
BenchmarkLog/uint64/10/basic-16 144678940 8.284 ns/op
BenchmarkLog/uint64/10/Log10-16 539179033 2.222 ns/op
BenchmarkAbs/basic-16 1000000000 0.9826 ns/op
BenchmarkAbs/Abs-16 1000000000 0.9647 ns/op
BenchmarkAbs/Abs2-16 1000000000 0.9943 ns/op
BenchmarkAbs/Abs3-16 1000000000 0.9819 ns/op
BenchmarkAbs/Abs4-16 1000000000 1.003 ns/op
BenchmarkAbs/AbsFastMul-16 1000000000 0.9598 ns/op
BenchmarkAvg/basic-16 973716225 2.045 ns/op
BenchmarkAvg/AvgFloor-16 602586224 2.050 ns/op
BenchmarkAvg/AvgCeil-16 582029594 2.054 ns/op
BenchmarkCycleThree/basic-16 767160418 1.560 ns/op
BenchmarkCycleThree/CycleThreeValues-16 438818894 2.729 ns/op
BenchmarkLeadingZeros/uint32/basic-16 1000000000 0.9419 ns/op
BenchmarkLeadingZeros/uint32/LeadingZerosUint32-16 1000000000 1.124 ns/op
BenchmarkLeadingZeros/uint64/basic-16 1000000000 0.9230 ns/op
BenchmarkLeadingZeros/uint64/LeadingZerosUint64-16 898095195 1.336 ns/op
BenchmarkCompress/Compress-16 100000000 10.60 ns/op
BenchmarkCompress/Compress2-16 55584826 21.52 ns/op
BenchmarkLRU/basic-16 246358870 4.870 ns/op
BenchmarkLRU/LRUCache-16 960896830 1.239 ns/op
BenchmarkMul/uint32/basic-16 593555838 1.892 ns/op
BenchmarkMul/uint32/MultiplyHighOrder32-16 951445552 2.046 ns/op
BenchmarkMul/uint64/basic-16 977065424 1.220 ns/op
BenchmarkMul/uint64/MultiplyHighOrder64-16 675693746 2.042 ns/op
BenchmarkDivMod/DivMod/3/basic-16 1000000000 0.8500 ns/op
BenchmarkDivMod/DivMod/3/DivMod3Signed-16 605588445 1.970 ns/op
BenchmarkDivMod/DivMod/3/DivMod3Signed2-16 1000000000 1.078 ns/op
BenchmarkDivMod/DivMod/7/basic-16 1000000000 0.8311 ns/op
BenchmarkDivMod/DivMod/7/DivMod7Signed-16 582087586 2.105 ns/op
BenchmarkDivMod/Div/3/basic-16 1000000000 0.8325 ns/op
BenchmarkDivMod/Div/3/Div3Signed-16 793883130 1.509 ns/op
BenchmarkDivMod/Div/3/Div3ShiftSigned-16 907116610 1.320 ns/op
BenchmarkDivMod/Div/7/basic-16 1000000000 0.8344 ns/op
BenchmarkDivMod/Div/7/Div7Signed-16 755509315 1.590 ns/op
BenchmarkDivMod/Div/7/Div7ShiftSigned-16 841563656 1.424 ns/op
BenchmarkDivMod/Mod/3/basic-16 1000000000 0.8309 ns/op
BenchmarkDivMod/Mod/3/Mod3Signed-16 812136249 1.466 ns/op
BenchmarkDivMod/Mod/3/Mod3Signed2-16 1000000000 0.8410 ns/op
BenchmarkDivMod/Mod/7/basic-16 1000000000 0.8332 ns/op
BenchmarkDivMod/Mod/7/Mod7Signed-16 766677633 1.564 ns/op
BenchmarkDivMod/Mod/7/Mod7Signed2-16 1000000000 1.095 ns/op
BenchmarkDivMod/Mod/10/basic-16 1000000000 0.8318 ns/op
BenchmarkDivMod/Mod/10/Mod10Signed-16 868932930 1.441 ns/op
BenchmarkDivMod/DivExact/7/basic-16 1000000000 0.9247 ns/op
BenchmarkDivMod/DivExact/7/DivExact7-16 1000000000 0.9238 ns/op
BenchmarkDivMod/DivExact/7/Div7Signed-16 718667949 1.668 ns/op
BenchmarkDivMod/DivExact/7/Div7ShiftSigned-16 802988229 1.490 ns/op
BenchmarkCbrt/basic-16 47340079 26.01 ns/op
BenchmarkCbrt/Cbrt-16 85196262 14.55 ns/op
BenchmarkPow/basic-16 24005180 48.25 ns/op
BenchmarkPow/Pow-16 65121390 19.08 ns/op
BenchmarkLog/uint32/2/basic-16 99810775 12.06 ns/op
BenchmarkLog/uint32/2/Log2-16 984283590 1.223 ns/op
BenchmarkLog/uint32/10/basic-16 140540709 8.516 ns/op
BenchmarkLog/uint32/10/Log10-16 539441811 2.220 ns/op
BenchmarkLog/uint64/2/basic-16 100000000 11.73 ns/op
BenchmarkLog/uint64/2/Log2-16 839779903 1.419 ns/op
BenchmarkLog/uint64/10/basic-16 142679388 8.419 ns/op
BenchmarkLog/uint64/10/Log10-16 538269764 2.228 ns/op
BenchmarkSqrt/basic-16 1000000000 1.019 ns/op
BenchmarkSqrt/SqrtNewton-16 170914454 6.656 ns/op
BenchmarkSqrt/SqrtBinarySearch-16 73125955 16.40 ns/op
BenchmarkSqrt/SqrtShiftAndSubtract-16 135757068 8.813 ns/op
BenchmarkCRC32/basic-16 222373198 5.397 ns/op
BenchmarkCRC32/CRC32Basic-16 447698 2522 ns/op
BenchmarkCRC32/CRC32TableLookup-16 8125387 147.7 ns/op
BenchmarkRSqrtFloat32/basic-16 1000000000 0.9349 ns/op
BenchmarkRSqrtFloat32/CRC32Basic-16 830151805 1.447 ns/op
BenchmarkSqrt/SqrtNewton-16 188142513 6.538 ns/op
BenchmarkSqrt/SqrtBinarySearch-16 74752382 15.71 ns/op
BenchmarkSqrt/SqrtShiftAndSubtract-16 136426688 8.834 ns/op
BenchmarkCRC32/basic-16 220094371 5.395 ns/op
BenchmarkCRC32/CRC32Basic-16 448540 2510 ns/op
BenchmarkCRC32/CRC32TableLookup-16 8108901 147.5 ns/op
BenchmarkRSqrtFloat32/basic-16 1000000000 0.9354 ns/op
BenchmarkRSqrtFloat32/RSqrtFloat32-16 828149971 1.448 ns/op
PASS
ok github.com/nikolaydubina/go-hackers-delight 89.462s
ok github.com/nikolaydubina/go-hackers-delight 91.183s
```
</details>

Expand Down

0 comments on commit 92e86de

Please sign in to comment.