mirror of
https://github.com/openharmony/third_party_rust_rust-smallvec.git
synced 2026-07-19 14:53:33 -04:00
aabaee0a82eb851d31c78ab8627f658b48febbe0
from_slice
This adds "bench_from_slice(_vec)(_small)" benches, renaming the previous versions to "bench_from_iter*" (because they were using `From<&[T]>`, which calls `FromIterator` internally) and optimizes the `from_slice` constructor considerably. Before: ``` test bench_from_slice ... bench: 42 ns/iter (+/- 0) test bench_from_slice_small ... bench: 12 ns/iter (+/- 0) ``` After: ``` test bench_from_slice ... bench: 27 ns/iter (+/- 0) test bench_from_slice_small ... bench: 8 ns/iter (+/- 0) ```
Import from https://github.com/servo/rust-selectors/blob/e8dd4cfe4d6a40363ca5df468b29121fe25a7956/src/smallvec.rs
rust-smallvec
"Small vector" optimization for Rust: store up to a small number of items on the stack
Description
Languages
Rust
98.8%
Shell
1.2%