You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2022/08/01 23:26:01 UTC

[arrow-rs] branch master updated: Use initial capacity for interner (#2272)

This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new b4fa47d9c Use initial capacity for interner (#2272)
b4fa47d9c is described below

commit b4fa47d9c8323e45985563e2bd1478aa1a23639e
Author: Daniƫl Heres <da...@gmail.com>
AuthorDate: Tue Aug 2 01:25:56 2022 +0200

    Use initial capacity for interner (#2272)
---
 parquet/src/util/interner.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/parquet/src/util/interner.rs b/parquet/src/util/interner.rs
index c0afad8e5..319750dd1 100644
--- a/parquet/src/util/interner.rs
+++ b/parquet/src/util/interner.rs
@@ -20,6 +20,8 @@ use hashbrown::hash_map::RawEntryMut;
 use hashbrown::HashMap;
 use std::hash::Hash;
 
+const DEFAULT_DEDUP_CAPACITY: usize = 4096;
+
 /// Storage trait for [`Interner`]
 pub trait Storage {
     type Key: Copy;
@@ -53,7 +55,7 @@ impl<S: Storage> Interner<S> {
     pub fn new(storage: S) -> Self {
         Self {
             state: Default::default(),
-            dedup: Default::default(),
+            dedup: HashMap::with_capacity_and_hasher(DEFAULT_DEDUP_CAPACITY, ()),
             storage,
         }
     }