Open cespare opened 5 years ago
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.
I did the benchmarking change in e0ea1e3196ac0aac60eccd7670662049875d8b7b.
Just in case someone does care, I'll make the forwarding function change as part of v3.
The comparison benchmarks can do direct calls if they're written with build tags. I did that in my Bloom filter package.
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: https://github.com/golang/go/issues/8421