about summary refs log tree commit diff
path: root/library/std/src/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-02-16 18:59:29 +0100
committerGitHub <noreply@github.com>2022-02-16 18:59:29 +0100
commit9a4212113592e83fb68ef9f347436d0d13517c1d (patch)
tree7a1cc369ed510d6e2d68caaf5809ac753242ce66 /library/std/src/sys/unix/stack_overflow.rs
parent01f0da2373183482148deee18e35fcad202d045e (diff)
parent3960ce6ec5222d77a5aa1681eca36f2a59c62c1b (diff)
downloadrust-9a4212113592e83fb68ef9f347436d0d13517c1d.tar.gz
rust-9a4212113592e83fb68ef9f347436d0d13517c1d.zip
Rollup merge of #93962 - joboet:branchless_slice_ord, r=Mark-Simulacrum
Make [u8]::cmp implementation branchless

The current implementation generates rather ugly assembly code, branching when the common parts are equal. By performing the comparison of the lengths upfront using a subtraction, the assembly gets much prettier: https://godbolt.org/z/4e5fnEKGd.

This will probably not impact speed too much, as the expensive part is in most cases the `memcmp`, but it sure looks better (I'm porting a sorting algorithm currently, and that branch just bothered me).
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions