From 213c105ac15413177f69f15b895e4cf9a41c3bf4 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 1 Jun 2023 19:41:22 +0300 Subject: [PATCH] [#8] go.mod: Use faster murmur3 lib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specifically, this line became possible, because of noescape annotations for assembly. ``` ./hrw.go:307:14: make([]byte, 8) does not escape ``` ``` goos: linux goarch: amd64 pkg: git.frostfs.info/TrueCloudLab/hrw cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz │ 1 │ 2 │ │ sec/op │ sec/op vs base │ SortHashersByValue_Typed_fnv_10-8 580.1n ± 1% 368.5n ± 2% -36.47% (p=0.000 n=10) SortHashersByValue_Typed_fnv_100-8 4.215µ ± 2% 2.411µ ± 4% -42.79% (p=0.000 n=10) SortHashersByValue_Typed_fnv_1000-8 39.40µ ± 1% 22.19µ ± 2% -43.68% (p=0.000 n=10) SortHashersByWeightValueTyped_fnv_10-8 599.6n ± 2% 364.3n ± 2% -39.25% (p=0.000 n=10) SortHashersByWeightValueTyped_fnv_100-8 4.337µ ± 5% 2.541µ ± 3% -41.41% (p=0.000 n=10) SortHashersByWeightValueTyped_fnv_1000-8 4.344µ ± 3% 2.483µ ± 1% -42.84% (p=0.000 n=10) geomean 4.400µ 1.888µ -41.13% ¹ ¹ benchmark set differs from baseline; geomeans may not be comparable │ 1 │ 2 │ │ B/op │ B/op vs base │ SortHashersByValue_Typed_fnv_10-8 472.0 ± 0% 312.0 ± 0% -33.90% (p=0.000 n=10) SortHashersByValue_Typed_fnv_100-8 3.461Ki ± 0% 1.898Ki ± 0% -45.15% (p=0.000 n=10) SortHashersByValue_Typed_fnv_1000-8 31.77Ki ± 0% 16.15Ki ± 0% -49.18% (p=0.000 n=10) SortHashersByWeightValueTyped_fnv_10-8 472.0 ± 0% 312.0 ± 0% -33.90% (p=0.000 n=10) SortHashersByWeightValueTyped_fnv_100-8 3.461Ki ± 0% 1.898Ki ± 0% -45.15% (p=0.000 n=10) SortHashersByWeightValueTyped_fnv_1000-8 3.461Ki ± 0% 1.898Ki ± 0% -45.15% (p=0.000 n=10) geomean 3.070Ki 1.474Ki -42.37% ¹ ¹ benchmark set differs from baseline; geomeans may not be comparable │ 1 │ 2 │ │ allocs/op │ allocs/op vs base │ SortHashersByValue_Typed_fnv_10-8 16.000 ± 0% 6.000 ± 0% -62.50% (p=0.000 n=10) SortHashersByValue_Typed_fnv_100-8 106.000 ± 0% 6.000 ± 0% -94.34% (p=0.000 n=10) SortHashersByValue_Typed_fnv_1000-8 1006.000 ± 0% 6.000 ± 0% -99.40% (p=0.000 n=10) SortHashersByWeightValueTyped_fnv_10-8 16.000 ± 0% 6.000 ± 0% -62.50% (p=0.000 n=10) SortHashersByWeightValueTyped_fnv_100-8 106.000 ± 0% 6.000 ± 0% -94.34% (p=0.000 n=10) SortHashersByWeightValueTyped_fnv_1000-8 106.000 ± 0% 6.000 ± 0% -94.34% (p=0.000 n=10) geomean 113.0 6.000 -92.69% ¹ ¹ benchmark set differs from baseline; geomeans may not be comparable ``` Signed-off-by: Evgenii Stratonikov --- 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 65da441..801495f 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module git.frostfs.info/TrueCloudLab/hrw go 1.18 require ( - github.com/spaolacci/murmur3 v1.1.0 github.com/stretchr/testify v1.3.0 + github.com/twmb/murmur3 v1.1.8 ) require ( diff --git a/go.sum b/go.sum index d6c0f7c..40904b3 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg= +github.com/twmb/murmur3 v1.1.8/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= diff --git a/hrw.go b/hrw.go index 57f49fd..c9a7eeb 100644 --- a/hrw.go +++ b/hrw.go @@ -9,7 +9,7 @@ import ( "reflect" "sort" - "github.com/spaolacci/murmur3" + "github.com/twmb/murmur3" ) type (