Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove duplicated function definitions #22

Open
cespare opened this issue Apr 2, 2019 · 3 comments
Open

Remove duplicated function definitions #22

cespare opened this issue Apr 2, 2019 · 3 comments
Assignees
Milestone

Comments

@cespare
Copy link
Owner

cespare commented Apr 2, 2019

After Go 1.13 comes out, we can freely use "forwarding" functions and avoid duplicated definitions since these trivial mid-stack functions should be inlined now: golang/go#8421

@cespare cespare modified the milestone: v2 Nov 19, 2020
@cespare
Copy link
Owner Author

cespare commented Nov 20, 2020

I did look into this after Go 1.13 came out and noticed that adding back the forwarding functions caused the benchmarks to get slower. I didn't look into it much more.

I took a closer look today and discovered that the situation is more nuanced (at least with Go 1.15):

The benchmarks are written to be kind of generic and use indirect calls. But I suspect anyone who cares about spending an extra 2ns hashing a small string is using direct calls. So I'm tempted to add the forwarding functions and also rewrite the benchmarks to not use indirect calls.

cespare added a commit that referenced this issue Nov 20, 2020
As of Go 1.13 this can be inlined so it doesn't add overhead.

Fixes #22.
cespare added a commit that referenced this issue Nov 20, 2020
Move the important benchmarks back into the xxhash package itself.

Updates #22
@cespare
Copy link
Owner Author

cespare commented Nov 20, 2020

I did the benchmarking change in e0ea1e3.

Just in case someone does care, I'll make the forwarding function change as part of v3.

@cespare cespare self-assigned this Nov 20, 2020
@cespare cespare modified the milestones: v2, v3 Nov 20, 2020
@greatroar
Copy link
Contributor

The comparison benchmarks can do direct calls if they're written with build tags. I did that in my Bloom filter package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants