]> git.lizzy.rs Git - rust.git/commit
collections: Use slices parts in PartialEq for VecDeque
authorUlrik Sverdrup <bluss@users.noreply.github.com>
Tue, 26 Jan 2016 23:35:03 +0000 (00:35 +0100)
committerUlrik Sverdrup <bluss@users.noreply.github.com>
Tue, 26 Jan 2016 23:35:03 +0000 (00:35 +0100)
commitaeb3aba951bca3307a1cbb7d1882437091e8070b
treeaafdcd755cb13a7a1a4b9d3fef686adc77316107
parentd3174ce75112a52082580065b041f8f4330fefa5
collections: Use slices parts in PartialEq for VecDeque

This improves == for VecDeque by using the slice representation.

This will also improve further if codegen for slice comparison improves.

Benchmark run of 1000 u64 elements, comparing for equality (all equal).
Cpu time to compare the vecdeques is reduced to less than 50% of what it
was before.

```
test test_eq_u64       ... bench:  1,885 ns/iter (+/- 163) = 4244 MB/s
test test_eq_new_u64   ... bench:    802 ns/iter (+/- 100) = 9975 MB/s
```
src/libcollections/vec_deque.rs
src/libcollectionstest/vec_deque.rs