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

@@ -170,7 +170,7 @@ fn script_with_braces<'r, 's>(
}
fn script_with_braces_end(
starting_brace_depth: i32,
starting_brace_depth: i16,
) -> impl for<'r, 's> Fn(Context<'r, 's>, OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
move |context: Context, input: OrgSource<'_>| {
_script_with_braces_end(context, input, starting_brace_depth)
@@ -181,7 +181,7 @@ fn script_with_braces_end(
fn _script_with_braces_end<'r, 's>(
_context: Context<'r, 's>,
input: OrgSource<'s>,
starting_brace_depth: i32,
starting_brace_depth: i16,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
let current_depth = input.get_brace_depth() - starting_brace_depth;
if current_depth > 0 {