Fine tune hash map sizes.

This commit is contained in:
Stephen Chung
2020-11-15 13:49:54 +08:00
parent bde8917ed4
commit c919ee4e46
9 changed files with 69 additions and 54 deletions

View File

@@ -81,12 +81,12 @@ pub struct Module {
impl Default for Module {
fn default() -> Self {
Self {
modules: HashMap::with_capacity(4),
variables: HashMap::with_capacity(4),
all_variables: HashMap::with_capacity_and_hasher(32, StraightHasherBuilder),
modules: Default::default(),
variables: Default::default(),
all_variables: Default::default(),
functions: HashMap::with_capacity_and_hasher(64, StraightHasherBuilder),
all_functions: HashMap::with_capacity_and_hasher(256, StraightHasherBuilder),
type_iterators: HashMap::with_capacity(4),
type_iterators: Default::default(),
indexed: false,
}
}
@@ -1477,8 +1477,8 @@ impl Module {
if !self.indexed {
let mut qualifiers = Vec::with_capacity(4);
let mut variables = Vec::with_capacity(8);
let mut functions = Vec::with_capacity(16);
let mut variables = Vec::with_capacity(16);
let mut functions = Vec::with_capacity(256);
qualifiers.push("root");