Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use faster Log10 implementation based on the "Bit twiddling" hacks page: https://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 Also, add more testcases on boundary integers to catch possible off-by-one errors. ``` goos: linux goarch: amd64 pkg: github.com/holiman/uint256 cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz │ old │ new │ │ sec/op │ sec/op vs base │ Log10/Log10/uint256-8 1016.5n ± 6% 762.9n ± 1% -24.95% (p=0.000 n=10) Log10/Log10/big-8 27.66µ ± 5% 28.56µ ± 5% ~ (p=0.393 n=10) geomean 5.303µ 4.668µ -11.97% │ old │ new │ │ B/op │ B/op vs base │ Log10/Log10/uint256-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹ Log10/Log10/big-8 22.88Ki ± 0% 22.88Ki ± 0% ~ (p=1.000 n=10) ¹ geomean ² +0.00% ² ¹ all samples are equal ² summaries must be >0 to compute geomean │ old │ new │ │ allocs/op │ allocs/op vs base │ Log10/Log10/uint256-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹ Log10/Log10/big-8 510.0 ± 0% 510.0 ± 0% ~ (p=1.000 n=10) ¹ geomean ² +0.00% ² ¹ all samples are equal ² summaries must be >0 to compute geomean ``` Signed-off-by: Evgenii Stratonikov <[email protected]> --------- Signed-off-by: Evgenii Stratonikov <[email protected]> Co-authored-by: Evgenii Stratonikov <[email protected]>
- Loading branch information