db::Writer::load use size_hint for table.reserve
This commit is contained in:
parent
38cee92d5f
commit
78b319e41a
@ -112,6 +112,12 @@ where
|
|||||||
where
|
where
|
||||||
I: Iterator<Item = T>,
|
I: Iterator<Item = T>,
|
||||||
{
|
{
|
||||||
|
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 {
|
for item in iter {
|
||||||
self.push(item)?;
|
self.push(item)?;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user