From d5d2cb00d85209d271f07c2b9a60da13ebee9b69 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 3 Oct 2023 22:43:01 +0300 Subject: [PATCH] go.mod: Changes murmur3 hash library MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use github.com/twmb/murmur3 instead of github.com/spaolacci/murmur3. The last one does not look as a maintained library. Also, no performance degradation found: ``` goos: linux goarch: amd64 pkg: github.com/nspcc-dev/hrw cpu: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz │ getOld.txt │ getNew.txt │ │ sec/op │ sec/op vs base │ Sort_fnv_10-8 274.6n ± 10% 270.3n ± 2% ~ (p=0.066 n=10) Sort_fnv_100-8 2.806µ ± 3% 2.857µ ± 1% ~ (p=0.160 n=10) Sort_fnv_1000-8 80.50µ ± 31% 71.21µ ± 1% -11.54% (p=0.000 n=10) SortByIndex_fnv_10-8 528.7n ± 3% 517.2n ± 3% -2.18% (p=0.015 n=10) SortByIndex_fnv_100-8 5.126µ ± 1% 5.202µ ± 1% +1.50% (p=0.000 n=10) SortByIndex_fnv_1000-8 102.8µ ± 3% 102.6µ ± 1% ~ (p=0.869 n=10) SortByValue_fnv_10-8 741.5n ± 8% 482.4n ± 4% -34.94% (p=0.000 n=10) SortByValue_fnv_100-8 5.443µ ± 17% 2.802µ ± 10% -48.52% (p=0.000 n=10) SortByValue_fnv_1000-8 47.76µ ± 30% 25.52µ ± 4% -46.57% (p=0.000 n=10) SortByWeight_fnv_10-8 388.4n ± 9% 360.0n ± 4% ~ (p=0.079 n=10) SortByWeight_fnv_100-8 1.432µ ± 14% 1.473µ ± 4% ~ (p=0.197 n=10) SortByWeight_fnv_1000-8 11.50µ ± 5% 11.69µ ± 8% ~ (p=0.684 n=10) SortByWeightIndex_fnv_10-8 442.0n ± 4% 433.2n ± 4% ~ (p=0.342 n=10) SortByWeightIndex_fnv_100-8 5.912µ ± 2% 6.026µ ± 1% +1.92% (p=0.007 n=10) SortByWeightIndex_fnv_1000-8 153.2µ ± 1% 154.1µ ± 1% ~ (p=0.063 n=10) SortByWeightValue_fnv_10-8 763.1n ± 2% 518.4n ± 3% -32.07% (p=0.000 n=10) SortByWeightValue_fnv_100-8 5.233µ ± 2% 3.062µ ± 3% -41.50% (p=0.000 n=10) SortByWeightValue_fnv_1000-8 49.08µ ± 1% 26.93µ ± 4% -45.12% (p=0.000 n=10) geomean 4.776µ 3.954µ -17.21% │ getOld.txt │ getNew.txt │ │ B/op │ B/op vs base │ Sort_fnv_10-8 216.0 ± 0% 216.0 ± 0% ~ (p=1.000 n=10) ¹ Sort_fnv_100-8 1.805Ki ± 0% 1.805Ki ± 0% ~ (p=1.000 n=10) ¹ Sort_fnv_1000-8 16.05Ki ± 0% 16.05Ki ± 0% ~ (p=1.000 n=10) ¹ SortByIndex_fnv_10-8 352.0 ± 0% 352.0 ± 0% ~ (p=1.000 n=10) ¹ SortByIndex_fnv_100-8 1.938Ki ± 0% 1.938Ki ± 0% ~ (p=1.000 n=10) ¹ SortByIndex_fnv_1000-8 16.19Ki ± 0% 16.19Ki ± 0% ~ (p=1.000 n=10) ¹ SortByValue_fnv_10-8 592.0 ± 0% 432.0 ± 0% -27.03% (p=0.000 n=10) SortByValue_fnv_100-8 4.375Ki ± 0% 2.812Ki ± 0% -35.71% (p=0.000 n=10) SortByValue_fnv_1000-8 39.81Ki ± 0% 24.19Ki ± 0% -39.25% (p=0.000 n=10) SortByWeight_fnv_10-8 448.0 ± 0% 448.0 ± 0% ~ (p=1.000 n=10) ¹ SortByWeight_fnv_100-8 2.828Ki ± 0% 2.828Ki ± 0% ~ (p=1.000 n=10) ¹ SortByWeight_fnv_1000-8 24.20Ki ± 0% 24.20Ki ± 0% ~ (p=1.000 n=10) ¹ SortByWeightIndex_fnv_10-8 368.0 ± 0% 368.0 ± 0% ~ (p=1.000 n=10) ¹ SortByWeightIndex_fnv_100-8 1.953Ki ± 0% 1.953Ki ± 0% ~ (p=1.000 n=10) ¹ SortByWeightIndex_fnv_1000-8 16.20Ki ± 0% 16.20Ki ± 0% ~ (p=1.000 n=10) ¹ SortByWeightValue_fnv_10-8 608.0 ± 0% 448.0 ± 0% -26.32% (p=0.000 n=10) SortByWeightValue_fnv_100-8 4.391Ki ± 0% 2.828Ki ± 0% -35.59% (p=0.000 n=10) SortByWeightValue_fnv_1000-8 39.83Ki ± 0% 24.20Ki ± 0% -39.23% (p=0.000 n=10) geomean 2.918Ki 2.539Ki -12.96% ¹ all samples are equal │ getOld.txt │ getNew.txt │ │ allocs/op │ allocs/op vs base │ Sort_fnv_10-8 4.000 ± 0% 4.000 ± 0% ~ (p=1.000 n=10) ¹ Sort_fnv_100-8 4.000 ± 0% 4.000 ± 0% ~ (p=1.000 n=10) ¹ Sort_fnv_1000-8 4.000 ± 0% 4.000 ± 0% ~ (p=1.000 n=10) ¹ SortByIndex_fnv_10-8 7.000 ± 0% 7.000 ± 0% ~ (p=1.000 n=10) ¹ SortByIndex_fnv_100-8 7.000 ± 0% 7.000 ± 0% ~ (p=1.000 n=10) ¹ SortByIndex_fnv_1000-8 7.000 ± 0% 7.000 ± 0% ~ (p=1.000 n=10) ¹ SortByValue_fnv_10-8 18.000 ± 0% 8.000 ± 0% -55.56% (p=0.000 n=10) SortByValue_fnv_100-8 108.000 ± 0% 8.000 ± 0% -92.59% (p=0.000 n=10) SortByValue_fnv_1000-8 1008.000 ± 0% 8.000 ± 0% -99.21% (p=0.000 n=10) SortByWeight_fnv_10-8 8.000 ± 0% 8.000 ± 0% ~ (p=1.000 n=10) ¹ SortByWeight_fnv_100-8 8.000 ± 0% 8.000 ± 0% ~ (p=1.000 n=10) ¹ SortByWeight_fnv_1000-8 8.000 ± 0% 8.000 ± 0% ~ (p=1.000 n=10) ¹ SortByWeightIndex_fnv_10-8 7.000 ± 0% 7.000 ± 0% ~ (p=1.000 n=10) ¹ SortByWeightIndex_fnv_100-8 7.000 ± 0% 7.000 ± 0% ~ (p=1.000 n=10) ¹ SortByWeightIndex_fnv_1000-8 7.000 ± 0% 7.000 ± 0% ~ (p=1.000 n=10) ¹ SortByWeightValue_fnv_10-8 18.000 ± 0% 8.000 ± 0% -55.56% (p=0.000 n=10) SortByWeightValue_fnv_100-8 108.000 ± 0% 8.000 ± 0% -92.59% (p=0.000 n=10) SortByWeightValue_fnv_1000-8 1008.000 ± 0% 8.000 ± 0% -99.21% (p=0.000 n=10) geomean 17.05 6.817 -60.01% ¹ all samples are equal ``` Closes #17. Signed-off-by: Pavel Karpy --- go.mod | 2 +- go.sum | 4 ++-- hrw.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 54d5f76..efec6b6 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/nspcc-dev/hrw go 1.19 require ( - github.com/spaolacci/murmur3 v1.1.0 github.com/stretchr/testify v1.8.4 + github.com/twmb/murmur3 v1.1.8 ) require ( diff --git a/go.sum b/go.sum index d004ff9..5103686 100644 --- a/go.sum +++ b/go.sum @@ -2,10 +2,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg= +github.com/twmb/murmur3 v1.1.8/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/hrw.go b/hrw.go index 882070a..124353d 100644 --- a/hrw.go +++ b/hrw.go @@ -9,7 +9,7 @@ import ( "reflect" "sort" - "github.com/spaolacci/murmur3" + "github.com/twmb/murmur3" ) type (