Change slice::to_vec to not use extend_from_slice

This also required adding a loop guard in case clone panics

Add specialization for copy

There is a better version for copy, so I've added specialization for that function
and hopefully that should speed it up even more.

Switch FromIter<slice::Iter> to use `to_vec`

Test different unrolling version for to_vec

Revert to impl

From benchmarking, it appears this version is faster
This commit is contained in:
kadmin 2020-11-18 22:59:47 +00:00
parent a1a13b2bc4
commit a9915581d7
3 changed files with 85 additions and 17 deletions

View file

@ -0,0 +1,10 @@
// compile-flags: -O
#![crate_type = "lib"]
// CHECK-LABEL: @copy_to_vec
#[no_mangle]
fn copy_to_vec(s: &[u64]) -> Vec<u64> {
s.to_vec()
// CHECK: call void @llvm.memcpy
}