Cannot efficiently extend SliceDeque from slice without using "unstable" feature
FrancisRussell opened this issue · 2 comments
SliceDeque
has extend_from_slice()
, which is an operation that can typically be implemented using a memcpy()
/memove()
. However, SliceDeque
's extend_from_slice()
will only do this when the "unstable" feature is active, which in turn requires a nightly compiler. This effectively means that there is no easy and efficient way to extend a SliceDeque
from a slice without a careful selection of compiler and modifications to a Cargo.toml
.
The point of extend_from_slice()
's existence on std::vec::Vec
(for example) is to enable use of the more efficient implementation of extension when the input is a slice. However, SliceDeque::extend_from_slice()
is only efficient at the same time that SliceDeque::extend()
would be as well (when specialisation is enabled) defeating the point of this function's existence.
In it's current form, extend_from_slice()
is misleading as is gives the impression that it will be more efficient than extend. It was only when profiling a particularly data-movement intensive piece of code that I realised that this was not the case.
Yeah, SliceDeque::extend_from_slice
's stable Rust implementation should not just call Extend::extend
. This shouldn't be too hard to fix.
Could you confirm that v0.1.14 fixes this?