From: bors Date: Sat, 15 Oct 2016 08:48:42 +0000 (-0700) Subject: Auto merge of #37094 - fhartwig:spec-extend-from-slice, r=alexcrichton X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=030bc49bb44834e691fd67452b39b438fa6d826d;p=rust.git Auto merge of #37094 - fhartwig:spec-extend-from-slice, r=alexcrichton 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) ``` --- 030bc49bb44834e691fd67452b39b438fa6d826d