]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #50398 - llogiq:memchr-nano-opt, r=nagisa
authorbors <bors@rust-lang.org>
Fri, 4 May 2018 05:38:18 +0000 (05:38 +0000)
committerbors <bors@rust-lang.org>
Fri, 4 May 2018 05:38:18 +0000 (05:38 +0000)
nano-optimization for memchr::repeat_byte

This replaces the multiple shifts & bitwise or with a single multiplication

In my benchmarks this performs equally well or better, especially on 64bit systems (it shaves a stable nanosecond on my skylake). This may go against conventional wisdom, but the shifts and bitwise ors cannot be pipelined because of hard data dependencies.

While it may or may not be worthwile from an optimization standpoint, it also reduces code size, so there's basically no downside.


No differences found