Skip to content

Optimize inline closer indexing - #129

Open
bobzhang wants to merge 1 commit into
mainfrom
codex/optimize-cmark-parser
Open

Optimize inline closer indexing#129
bobzhang wants to merge 1 commit into
mainfrom
codex/optimize-cmark-parser

Conversation

@bobzhang

Copy link
Copy Markdown
Contributor

Summary

  • build the inline closer index during tokenization instead of doing a second Deque::retain pass
  • store closer positions in append-ordered arrays and use binary search for first-closer lookup
  • bypass full inline resolution for token streams that contain only newline tokens

Validation

  • moon check
  • moon test
  • cd cmarkwrap && moon check
  • cd cmarkwrap && moon test

Profiling

  • Confirmed moon run --profile --target native --release works locally with macOS Time Profiler.
  • Parser-only spec.md.repeat(4) benchmark, 20 runs: current branch mean ~10096 vs fresh origin/main mean ~10293 in the same session. The win is modest, but the patch removes a real extra token pass and set-based closer lookup from the inline parser.

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