Repository navigation
perf: avoid repeated inline markup closing-marker scans - #68
Open
fullofcaffeine wants to merge 1 commit into
Open
fullofcaffeine wants to merge 1 commit into
fullofcaffeine wants to merge 1 commit into
Conversation
Large files with repeated generic types can make markup detection scan the remaining source repeatedly. Remember the next closing markers while the cursor advances, and return the less-than token when neither closing form exists. Keep this state local to one markup scan. Preserve the existing nesting decisions, token contents, and cursor updates. Add focused tests for nested and adjacent markup, incomplete input, and Unicode text followed by another token. Validation includes 5,199 differential lexer cases, the formatter's 1,831 assertions, and the current parser's 515 assertions on Haxe 4.3.7. The optimization does not repair the existing Unicode markup start offset or change formatter rules. Full consumer adoption remains separate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
perf: avoid repeated closing-marker searches in inline markup
Large Haxe files with many generic types can spend minutes in the formatter's markup lexer.
The lexer repeatedly scans the remaining text for the same closing markers while its cursor advances.
This patch keeps the next closing-tag and self-closing positions within each inlineMarkup call.
It searches again only after the cursor passes a found marker.
When both closing forms are absent, it immediately returns the ordinary less-than token.
The existing token decisions, nesting rules, and cursor updates remain in place.
On one 25,517-line C++ backend module, an unchanged formatter build exceeded 150 seconds; the candidate completed its check in 99 seconds.
These are operational results on a shared host, not a controlled benchmark.
The patch targets upstream master at 49db59c.
The affected lexer code is identical to the formatter's pinned parser version used for the timing comparison.
Validation:
Agent provenance
Prepared by the hxhx-local-identity-maintainer agent using GPT-6 while investigating task haxe_ocaml-vz0h6.
Repeated formatter timeouts blocked verification of a compiler fix, which led the agent to profile the parser dependency.
The agent retains responsibility for review fixes and rebasing; upstream maintainers control acceptance and merge.
Other agents should preserve this ownership unless the repository owner records a handoff.
No upstream compiler implementation was copied into hxhx; this patch edits the existing BSD-licensed parser dependency at its owner.