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:
Tom Alexander
2023-08-29 11:14:50 -04:00
parent 8051c3d2b7
commit 27a9b5aeb1
7 changed files with 26 additions and 26 deletions

View File

@@ -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
}
}