diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2020-08-14 20:07:16 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-14 20:07:16 -0700 |
| commit | 29a946203aeebdd0d8466968705694fea9ca866f (patch) | |
| tree | aa173050fa295a736d6ab1e5a1a23529262e1b9b /src/test/rustdoc-ui/coverage/json.rs | |
| parent | e38eaf22d247644e5554d0c200e6df756e469b0a (diff) | |
| parent | a7ad899f9dbce1b4a0beb56650bc72732f204d24 (diff) | |
| download | rust-29a946203aeebdd0d8466968705694fea9ca866f.tar.gz rust-29a946203aeebdd0d8466968705694fea9ca866f.zip | |
Rollup merge of #75545 - eddyb:instant-sub-branchless, r=sfackler
std/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction. This PR is the minimal change necessary to get LLVM to optimize `if self.t.tv_nsec >= other.t.tv_nsec` to branchless instructions (at least on x86_64), inspired by @m-ou-se's own attempts at optimizing `Instant` subtraction. I stumbled over this by looking at the total number of instructions executed by `rustc -Z self-profile`, and found that after disabling ASLR, the largest source of non-determinism remaining was from this `if` taking one branch or the other, depending on the values involved. The reason this code is even called so many times to make a difference, is that `measureme` (the `-Z self-profile` implementation) currently uses `Instant::elapsed` for its event timestamps (of which there can be millions). I doubt it's critical to land this, although perhaps it could slightly improve some forms of benchmarking.
Diffstat (limited to 'src/test/rustdoc-ui/coverage/json.rs')
0 files changed, 0 insertions, 0 deletions
