about summary refs log tree commit diff
path: root/src/test/ui/thinlto
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-04-02 13:47:21 +0200
committerGitHub <noreply@github.com>2019-04-02 13:47:21 +0200
commitc9d9df58300715d35a0dd5f9af0d1adbbfed8412 (patch)
tree302b7666b7ec7123a0f44a3eba06c3b7d1736b85 /src/test/ui/thinlto
parentf694222887cf31f51e68927716c25736e62f037f (diff)
parent075b2697e47e9370dcf2d38f01469b38bd4d903e (diff)
downloadrust-c9d9df58300715d35a0dd5f9af0d1adbbfed8412.tar.gz
rust-c9d9df58300715d35a0dd5f9af0d1adbbfed8412.zip
Rollup merge of #59262 - timvermeulen:iterator_cmp_dedup, r=scottmcm
Remove duplicated code from Iterator::{ne, lt, le, gt, ge}

This PR delegates `Iterator::ne` to `Iterator::eq` and `Iterator::{lt, le, gt, ge}` to `Iterator::partial_cmp`.

Oddly enough, this change actually simplifies the generated assembly [in some cases](https://rust.godbolt.org/z/riBtNe), although I don't understand assembly well enough to see if the longer assembly is doing something clever.

I also added two extremely simple benchmarks:
```
// before
test iter::bench_lt               ... bench:      98,404 ns/iter (+/- 21,008)
test iter::bench_partial_cmp      ... bench:      62,437 ns/iter (+/- 5,009)

// after
test iter::bench_lt               ... bench:      61,757 ns/iter (+/- 8,770)
test iter::bench_partial_cmp      ... bench:      62,151 ns/iter (+/- 13,753)
```

I have no idea why the current `lt`/`le`/`gt`/`ge` implementations don't seem to be compiled optimally, but simply having them call `partial_cmp` seems to be an improvement.

See #44729 for a previous discussion.
Diffstat (limited to 'src/test/ui/thinlto')
0 files changed, 0 insertions, 0 deletions