]> git.lizzy.rs Git - rust.git/commit
Improve the range comparison
authorAndrea Canciani <ranma42@gmail.com>
Mon, 4 Jan 2016 16:35:06 +0000 (17:35 +0100)
committerAndrea Canciani <ranma42@gmail.com>
Mon, 4 Jan 2016 16:51:12 +0000 (17:51 +0100)
commitaa77f39ccf2786b864206f24e85661eee63022a8
treed63a07fc865dd17c6c76efbef5d5e2d3c1afa905
parentcf3fcf7758f4e568a5b97bdeffe7131a167e918f
Improve the range comparison

As mentioned in #29734, the range comparison closure can be improved.

The LLVM IR and the assembly from the new version are much simpler and
unfortunately we cannot rely on the compiler to optimise this much, as
it would need to know that `lo <= hi`.

Besides from simpler code, there might also be a performance
advantage, although it is unlikely to appear on benchmarks, as we are
doing a binary search, which should always involve few comparisons.

The code is available on the playpen for ease of comparison:
http://is.gd/4raMmH
src/etc/unicode.py