Optimize scope.
This commit is contained in:
parent
70f09d1c84
commit
e64dad4e9f
@ -2128,7 +2128,7 @@ mod tests {
|
|||||||
96
|
96
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
assert_eq!(size_of::<Scope>(), 288);
|
assert_eq!(size_of::<Scope>(), 160);
|
||||||
assert_eq!(size_of::<LexError>(), 56);
|
assert_eq!(size_of::<LexError>(), 56);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
size_of::<ParseError>(),
|
size_of::<ParseError>(),
|
||||||
|
@ -7,7 +7,7 @@ use std::prelude::v1::*;
|
|||||||
use std::{borrow::Cow, iter::Extend};
|
use std::{borrow::Cow, iter::Extend};
|
||||||
|
|
||||||
/// Keep a number of entries inline (since [`Dynamic`] is usually small enough).
|
/// Keep a number of entries inline (since [`Dynamic`] is usually small enough).
|
||||||
const SCOPE_SIZE: usize = 16;
|
const SCOPE_SIZE: usize = 8;
|
||||||
|
|
||||||
/// Type containing information about the current scope.
|
/// Type containing information about the current scope.
|
||||||
/// Useful for keeping state between [`Engine`][crate::Engine] evaluation runs.
|
/// Useful for keeping state between [`Engine`][crate::Engine] evaluation runs.
|
||||||
@ -98,7 +98,7 @@ impl<'a> Scope<'a> {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
values: Default::default(),
|
values: Default::default(),
|
||||||
names: Vec::with_capacity(SCOPE_SIZE),
|
names: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Empty the [`Scope`].
|
/// Empty the [`Scope`].
|
||||||
|
Loading…
Reference in New Issue
Block a user