diff --git a/src/db.rs b/src/db.rs index 9d93cee..9c12dab 100644 --- a/src/db.rs +++ b/src/db.rs @@ -112,6 +112,12 @@ where where I: Iterator, { + let hint = iter.size_hint(); + let hint = std::cmp::max(hint.0, hint.1.unwrap_or(0)); + if hint > 0 { + self.table.reserve(hint); + } + for item in iter { self.push(item)?; }