Switch to i16 for backet depth count.
This is having a measurable performance increase. 32k bracket depth should be enough for any non-malicious document.
This commit is contained in:
@@ -17,10 +17,10 @@ pub struct OrgSource<'s> {
|
||||
start: usize,
|
||||
end: usize, // exclusive
|
||||
start_of_line: usize,
|
||||
bracket_depth: i16, // []
|
||||
brace_depth: i16, // {}
|
||||
parenthesis_depth: i16, // ()
|
||||
preceding_character: Option<char>,
|
||||
bracket_depth: i32, // []
|
||||
brace_depth: i32, // {}
|
||||
parenthesis_depth: i32, // ()
|
||||
}
|
||||
|
||||
impl<'s> std::fmt::Debug for OrgSource<'s> {
|
||||
@@ -71,15 +71,15 @@ impl<'s> OrgSource<'s> {
|
||||
self.slice(..(other.start - self.start))
|
||||
}
|
||||
|
||||
pub fn get_bracket_depth(&self) -> i32 {
|
||||
pub fn get_bracket_depth(&self) -> i16 {
|
||||
self.bracket_depth
|
||||
}
|
||||
|
||||
pub fn get_brace_depth(&self) -> i32 {
|
||||
pub fn get_brace_depth(&self) -> i16 {
|
||||
self.brace_depth
|
||||
}
|
||||
|
||||
pub fn get_parenthesis_depth(&self) -> i32 {
|
||||
pub fn get_parenthesis_depth(&self) -> i16 {
|
||||
self.parenthesis_depth
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user