Re:Rust's integer intrinsics are impressive
by Someone on Saturday June 10, 2017 @10:28AM
(#14527447)
Reading http://0x80.pl/articles/sse-popcount.html, I would think the hardware instruction is slower than the best software implementation. Or has that changed on newer hardware?
[ Parent
| on HN ]
This would not apply to the Rust method shown in the OP, since that one is operating on only 32 bits at a time.
It's unclear how well the benchmarks in this linked article generalize to other applications. If you are just popcounting in a tight loop, probably pretty well, but who does that? In reality you have other things going on, so if this method is occupying too many execution units or polluting your cache, you would see the effect of that on the rest of the program. But it's program-dependent, thus unclear.
Re:Rust's integer intrinsics are impressive
by the8472 on Saturday June 10, 2017 @11:09AM
(#14527605)
> since that one is operating on only 32 bits at a time.
https://doc.rust-lang.org/std/primitive.u64.html#method.coun...
https://doc.rust-lang.org/std/primitive.u128.html#method.cou...
Of course to benefit from the SSE optimizations you would still have to call it in a loop and the optimizer would have to recognize that and replace it with a vectorized approach.