]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #37094 - fhartwig:spec-extend-from-slice, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 15 Oct 2016 08:48:42 +0000 (01:48 -0700)
committerGitHub <noreply@github.com>
Sat, 15 Oct 2016 08:48:42 +0000 (01:48 -0700)
Specialize Vec::extend to Vec::extend_from_slice

I tried using the existing `SpecExtend` as a helper trait for this, but the instances would always conflict with the instances higher up in the file, so I created a new helper trait.

Benchmarking `extend` vs `extend_from_slice` with an slice of 1000 `u64`s gives the following results:

```
before:

running 2 tests
test tests::bench_extend_from_slice ... bench:         166 ns/iter (+/- 78)
test tests::bench_extend_trait      ... bench:       1,187 ns/iter (+/- 697)

after:
running 2 tests
test tests::bench_extend_from_slice ... bench:         149 ns/iter (+/- 87)
test tests::bench_extend_trait      ... bench:         138 ns/iter (+/- 70)
```

1  2 
src/libcollections/vec.rs

Simple merge