perf(scanner): fast-path identifier characters and short-circuit keyword scans#5
Conversation
|
Warning Review limit reached
More reviews will be available in 40 minutes and 29 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. Walkthroughsrc/scanner.c now short-circuits unary and binary operator keyword matching when the inspected character is outside lowercase ASCII. The expression scanner also adds a direct path for characters that satisfy 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…ord scans Port htmljs-parser's EXPRESSION fast paths to the external scanner: - Add an identifier/number-character fast path to the expression loop. Such a character is never whitespace, never a terminator (no should_terminate case matches a word character), and is not one of the switch's cases, so it short-circuits the termination checks (including should_terminate's eager lookahead) and the switch dispatch and just advances. - Bail out of the unary/binary operator keyword scans immediately when the surrounding character cannot start or end a keyword (every keyword is lowercase ASCII letters). No behavior change: the full fixture-comparison suite passes. ~6-9% faster on expression-heavy input in an A/B build. Mirrors marko-js/htmljs-parser#223 (commit 3c95d7f).
dd3f38d to
9e15dd6
Compare
Ports the expression fast paths from marko-js/htmljs-parser#223 (commit
3c95d7f) to the external scanner:switchcase, so it skips the per-character termination checks (includingshould_terminate's eager lookahead) and the switch dispatch and just advances.look_behind_for_operator/look_ahead_for_operatorbail out immediately when the boundary character can't start/end a keyword (every keyword is lowercase ASCII).No behavior change — the 372-fixture comparison suite passes identically. Measured ~6–9% faster on expression-heavy input in an A/B build (matching the ~6% reported upstream).
Generated by Claude Code