Skip to content

Commit 0a95b1b

Browse files
authored
Slight improvement for VTableRegistry::register_many (#3142)
just delegate to the inner `extend` function that also deals with reserving enough space. Saw it in a profile of a very fast query as part of clickbench, spent like 2ms just resizing this tiny map.
1 parent b32f7a3 commit 0a95b1b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

vortex-array/src/context.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ impl<T: Clone + Display + Eq> VTableRegistry<T> {
137137

138138
/// Register a new encoding, replacing any existing encoding with the same ID.
139139
pub fn register_many<I: IntoIterator<Item = T>>(&mut self, encodings: I) {
140-
encodings.into_iter().for_each(|encoding| {
141-
self.0.insert(encoding.to_string(), encoding);
142-
});
140+
self.0
141+
.extend(encodings.into_iter().map(|e| (e.to_string(), e)));
143142
}
144143
}

0 commit comments

Comments
 (0)