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:
@@ -92,7 +92,7 @@ fn header<'r, 's>(
|
||||
}
|
||||
|
||||
fn header_end(
|
||||
starting_bracket_depth: i32,
|
||||
starting_bracket_depth: i16,
|
||||
) -> impl for<'r, 's> Fn(Context<'r, 's>, OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
move |context: Context, input: OrgSource<'_>| {
|
||||
_header_end(context, input, starting_bracket_depth)
|
||||
@@ -103,7 +103,7 @@ fn header_end(
|
||||
fn _header_end<'r, 's>(
|
||||
_context: Context<'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
starting_bracket_depth: i32,
|
||||
starting_bracket_depth: i16,
|
||||
) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
let current_depth = input.get_bracket_depth() - starting_bracket_depth;
|
||||
if current_depth > 0 {
|
||||
@@ -152,7 +152,7 @@ fn body<'r, 's>(
|
||||
}
|
||||
|
||||
fn body_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<'_>| _body_end(context, input, starting_brace_depth)
|
||||
}
|
||||
@@ -161,7 +161,7 @@ fn body_end(
|
||||
fn _body_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 {
|
||||
|
||||
Reference in New Issue
Block a user