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

@@ -65,7 +65,7 @@ impl EntryType {
//
// Since `Dynamic` is reasonably small, packing it tightly improves cache locality when variables are accessed.
// The variable type is packed separately into another array because it is even smaller.
#[derive(Debug, Clone, Default)]
#[derive(Debug, Clone)]
pub struct Scope<'a> {
/// Current value of the entry.
values: Vec<Dynamic>,
@@ -75,6 +75,16 @@ pub struct Scope<'a> {
names: Vec<(Cow<'a, str>, Box<StaticVec<String>>)>,
}
impl Default for Scope<'_> {
fn default() -> Self {
Self {
values: Vec::with_capacity(16),
types: Vec::with_capacity(16),
names: Vec::with_capacity(16),
}
}
}
impl<'a> Scope<'a> {
/// Create a new Scope.
///