make Rank() inlineable #201
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
old: ./bitset.go:1388:6: cannot inline (*BitSet).Rank: function too complex: cost 106 exceeds budget 80
new: ./bitset.go:1388:6: can inline (*BitSet).Rank with cost 75
$ benchstat rank.old rank.new
goos: linux
goarch: amd64
pkg: github.com/bits-and-blooms/bitset
cpu: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
│ rank.old │ rank.new │
│ sec/op │ sec/op vs base │
Rank/Rank(1) 3.168n ± 1% 1.232n ± 2% -61.10% (p=0.002 n=6)
Rank/Rank(20) 3.165n ± 0% 1.224n ± 1% -61.34% (p=0.002 n=6)
Rank/Rank(50) 3.169n ± 2% 1.252n ± 2% -60.50% (p=0.002 n=6)
Rank/Rank(100) 3.607n ± 2% 2.371n ± 1% -34.28% (p=0.002 n=6)
Rank/Rank(200) 4.492n ± 0% 3.594n ± 0% -20.00% (p=0.002 n=6)
Rank/Rank(500) 6.010n ± 1% 4.806n ± 0% -20.03% (p=0.002 n=6)
Rank/Rank(1000) 9.538n ± 0% 7.724n ± 0% -19.02% (p=0.002 n=6)
Rank/Rank(10000) 77.26n ± 1% 56.96n ± 2% -26.26% (p=0.002 n=6)
Rank/Rank(20000) 145.9n ± 2% 103.6n ± 0% -28.99% (p=0.002 n=6)
Rank/Rank(50000) 351.2n ± 0% 244.2n ± 0% -30.48% (p=0.002 n=6)
Rank/Rank(100000) 699.6n ± 0% 478.5n ± 5% -31.60% (p=0.002 n=6)
Rank/Rank(200000) 699.1n ± 0% 478.3n ± 0% -31.59% (p=0.002 n=6)
geomean 24.91n 15.53n -37.66%