I did my best to bench a few of the consider alternatives. Benchmarking is an art that I don't master, but the code is on github and feedback is welcome.
The conclusion is that Inlining was not as useful as I hoped, for this micro-benchmark. PackedSieve seem to do as well. Also sieve tables really seems quite an attractive performance profile, on that micro-benchmark at least.
Size | 2 traits | 3 traits | 4 traits | 5 traits | |
---|---|---|---|---|---|
PackedSieve |
2 words | 464 ns | 488 ns | 482 ns | 495 ns |
InlineSieve |
3 words | 510 ns | 510 ns | 510 ns | 510 ns |
MultiVPtr |
N+1 words | 472 ns | 753 ns | 764 ns | 831 ns |
The README has a few pointers but this is all quick-and-dirty code. If there's interest I could add another benchmark, or if someone is interested to write one I'll add some documentation.