Optimize parser hot-paths - #347
Conversation
Replaced regex-based tag matching with manual character scans to minimize overhead. Adjusted functions like `parseStartTag`, `matchEndTag`, and `matchTagClose` to use fast-path ASCII processing while maintaining compatibility with existing logic. (This commit message was AI-generated.) Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. WalkthroughThe parser and minifier replace selected regular-expression checks with character-code scans. The parser reuses lowercased tag names and packs tag-close results. Tests cover non-ASCII tag names. Package metadata and the changelog advance to version 8.3.1. ChangesParser and minifier performance changes
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This PR optimizes parser and minifier hot paths while preserving the existing parser interface and fallback behavior; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ast-grep (0.45.2)test/html.test.jsast-grep timed out on this file Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Moved `matchPlainEndTag` to improve function organization and reduce duplication. Updated related tests to ensure correct handling of edge cases with non-ASCII tag names. (This commit message was AI-generated.) Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
…maxLineLength`) Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Summary by CodeRabbit
Performance
Bug Fixes
Chores
Documentation