Fine tune hash map sizes.
This commit is contained in:
12
src/scope.rs
12
src/scope.rs
@@ -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.
|
||||
///
|
||||
|
Reference in New Issue
Block a user