mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 05:10:11 +01:00
nak: Reserve capacity in LiveSet::from_iter,extend
Reviewed-by: Mary Guillemard <mary@mary.zone> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33306>
This commit is contained in:
parent
f64d2c8557
commit
5caee114ec
1 changed files with 4 additions and 0 deletions
|
|
@ -108,6 +108,8 @@ impl LiveSet {
|
|||
impl FromIterator<SSAValue> for LiveSet {
|
||||
fn from_iter<T: IntoIterator<Item = SSAValue>>(iter: T) -> Self {
|
||||
let mut set = LiveSet::new();
|
||||
let iter = iter.into_iter();
|
||||
set.set.reserve(iter.size_hint().0);
|
||||
for ssa in iter {
|
||||
set.insert(ssa);
|
||||
}
|
||||
|
|
@ -117,6 +119,8 @@ impl FromIterator<SSAValue> for LiveSet {
|
|||
|
||||
impl Extend<SSAValue> for LiveSet {
|
||||
fn extend<T: IntoIterator<Item = SSAValue>>(&mut self, iter: T) {
|
||||
let iter = iter.into_iter();
|
||||
self.set.reserve(iter.size_hint().0);
|
||||
for ssa in iter {
|
||||
self.insert(ssa);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue