about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-02 00:05:32 +0000
committerbors <bors@rust-lang.org>2024-06-02 00:05:32 +0000
commit12b5d3c29c221a4c61f9e6863f4bc1133f3e3403 (patch)
tree0303b22359ad595b27095c4643cd3820ea20304f /compiler/rustc_interface/src
parentf67a1acc04c7ecbf05751b17592dd8d245b75256 (diff)
parent245cc23a2f7d55c22437b2482f057fa44cce0624 (diff)
downloadrust-12b5d3c29c221a4c61f9e6863f4bc1133f3e3403.tar.gz
rust-12b5d3c29c221a4c61f9e6863f4bc1133f3e3403.zip
Auto merge of #124294 - tspiteri:ilog-first-iter, r=the8472
Unroll first iteration of checked_ilog loop

This follows the optimization of #115913. As shown in https://github.com/rust-lang/rust/pull/115913#issuecomment-2066788006, the performance was improved in all important cases, but some regressions were introduced for the benchmarks `u32_log_random_small`, `u8_log_random` and `u8_log_random_small`.

Basically, #115913 changed the implementation from one division per iteration to one multiplication per iteration plus one division. When there are zero iterations, this is a regression from zero divisions to one division.

This PR avoids this by avoiding the division if we need zero iterations by returning `Some(0)` early. It also reduces the number of multiplications by one in all other cases.
Diffstat (limited to 'compiler/rustc_interface/src')
0 files changed, 0 insertions, 0 deletions