summaryrefslogtreecommitdiff
path: root/tests/rustdoc-js-std/parser-errors.js
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-08 23:47:39 +0000
committerbors <bors@rust-lang.org>2023-05-08 23:47:39 +0000
commit90c02c1bc119890f63dedcb4bee5a278a85ff62f (patch)
tree73791a158ba7239fcca776d8ac66ffb7cad71f7d /tests/rustdoc-js-std/parser-errors.js
parent2f2c438dce75d8cc532c3baa849eeddc0901802c (diff)
parentb5ee324d79b310761b98173825895b16b859361b (diff)
downloadrust-90c02c1bc119890f63dedcb4bee5a278a85ff62f.tar.gz
Auto merge of #111296 - Sp00ph:const_gcd, r=nagisa,Mark-Simulacrum
Always const-evaluate the GCD in `slice::align_to_offsets` Use an inline `const`-block to force the compiler to calculate the GCD at compile time, even in debug mode. This shouldn't affect the behavior of the program at all, but it drastically cuts down on the number of instructions emitted with optimizations disabled. With the current implementation, a single `slice::align_to` instantiation (specifically `<[u8]>::align_to::<u128>()`) generates 676 instructions (on x86-64). Forcing the GCD computation to be const cuts it down to 327 instructions, so just over 50% less. This is obviously not representative of actual runtime gains, but I still see it as a significant win as long as it doesn't degrade compile times. Not having to worry about LLVM const-evaluating the GCD function also allows it to use the textbook recursive euclidean algorithm instead of a much more complicated iterative implementation with multiple `unsafe`-blocks.
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
0 files changed, 0 insertions, 0 deletions