commit | 1c65b3cc5f0add327d5ec5a1c0c705e1a6de6d77 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Feb 02 23:55:31 2024 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Feb 02 23:55:31 2024 +0000 |
tree | 85bba2898c7ba5b053d723b80a04dee78593f109 | |
parent | 487e691fe1b59d882f51dca8813a5f4b9330edd7 [diff] | |
parent | 5d9d02fb0ff17b83d0384d5a0e2389a8d4759c7e [diff] |
Snap for 11400057 from 5d9d02fb0ff17b83d0384d5a0e2389a8d4759c7e to simpleperf-release Change-Id: I9cf0e04029470f87955b663dda8f36bef6a3fc50
“Small vector” optimization for Rust: store up to a small number of items on the stack
use smallvec::{SmallVec, smallvec}; // This SmallVec can hold up to 4 items on the stack: let mut v: SmallVec<[i32; 4]> = smallvec![1, 2, 3, 4]; // It will automatically move its contents to the heap if // contains more than four items: v.push(5); // SmallVec points to a slice, so you can use normal slice // indexing and other methods to access its contents: v[0] = v[1] + v[2]; v.sort();