Skip to content

Optimize generated parser inlining - #318

Merged
sebastienros merged 1 commit into
mainfrom
sebros/perf-generated-email-parser
Aug 2, 2026
Merged

Optimize generated parser inlining#318
sebastienros merged 1 commit into
mainfrom
sebros/perf-generated-email-parser

Conversation

@sebastienros

Copy link
Copy Markdown
Owner

Generated combinator parsers pay a measurable cost for their helper-heavy call structure. Email parser benchmarks showed that JIT inlining can recover about 10.9% of that overhead, reducing the generated Parlot parser from 67.15 ns to 59.84 ns.

This change always marks the trivial generated parser wrapper for aggressive inlining and selectively applies the same hint to core, deferred, and helper methods with no more than 24 emitted local/body statements. The size gate preserves the measured benefit of blanket inlining while avoiding the code-size and instruction-cache risks of forcing large generated methods inline.

Regression coverage verifies that small hot-path methods receive the attribute while a larger generated choice core does not.

Apply aggressive inlining to generated parser wrappers and selectively to small generated methods, avoiding code growth for larger parser bodies.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 096afb8d-6bc6-4ba9-9af3-1602a00a2cf0
@sebastienros
sebastienros merged commit 7b515f7 into main Aug 2, 2026
1 check passed
@sebastienros
sebastienros deleted the sebros/perf-generated-email-parser branch August 2, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant