Improve Vec::resize so that it can be used in Read::read_to_end

We needed a more efficient way to zerofill the vector in read_to_end.
This to reduce the memory intialization overhead to a minimum.

Use the implementation of `std::vec::from_elem` (used for the vec![]
macro) for Vec::resize as well. For simple element types like u8, this
compiles to memset, so it makes Vec::resize much more efficient.
This commit is contained in:
Ulrik Sverdrup
2015-07-07 13:50:23 +02:00
parent 26f0cd5de7
commit 6ac0ba3c3a
3 changed files with 39 additions and 23 deletions

View File

@@ -146,6 +146,7 @@
#![feature(unique)]
#![feature(unsafe_no_drop_flag, filling_drop)]
#![feature(vec_push_all)]
#![feature(vec_resize)]
#![feature(wrapping)]
#![feature(zero_one)]
#![cfg_attr(windows, feature(str_utf16))]