Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Optimize MapOf integer hash function #76

Merged
merged 1 commit into from
Oct 31, 2022
Merged

Conversation

puzpuzpuz
Copy link
Owner

Benchmarks for MapOf[int, int] with 64 keys

Before:

BenchmarkIntegerMapOf_WarmUp/reads=100%-8         	170225940	         7.107 ns/op	       0 B/op	       0 allocs/op
BenchmarkIntegerMapOf_WarmUp/reads=99%-8          	147592124	         8.331 ns/op	       0 B/op	       0 allocs/op
BenchmarkIntegerMapOf_WarmUp/reads=90%-reads-8    	100000000	        11.09 ns/op	       1 B/op	       0 allocs/op
BenchmarkIntegerMapOf_WarmUp/reads=75%-reads-8    	78332457	        16.03 ns/op	       4 B/op	       0 allocs/op

After:

BenchmarkIntegerMapOf_WarmUp/reads=100%-8         	208831473	         5.325 ns/op	       0 B/op	       0 allocs/op
BenchmarkIntegerMapOf_WarmUp/reads=99%-8          	180287820	         6.516 ns/op	       0 B/op	       0 allocs/op
BenchmarkIntegerMapOf_WarmUp/reads=90%-reads-8    	127232131	         9.812 ns/op	       1 B/op	       0 allocs/op
BenchmarkIntegerMapOf_WarmUp/reads=75%-reads-8    	84348110	        13.95 ns/op	       4 B/op	       0 allocs/op

@puzpuzpuz puzpuzpuz self-assigned this Oct 31, 2022
@puzpuzpuz puzpuzpuz merged commit 24ebe2c into main Oct 31, 2022
@puzpuzpuz puzpuzpuz deleted the optimize-integer-mapof branch October 31, 2022 17:01
@@ -47,6 +48,18 @@ func parallelism() uint32 {
return numCores
}

// inthash64 is a hash function based on murmurhash3 64-bit finalizer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably the comment is outdated =)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True :)

Thanks for the review! Will fix the comment.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants