Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use StringScanner instead of String#scan to improve block parsing performance #167

Merged

Conversation

leonid-shevtsov
Copy link
Contributor

This PR replaces scan in parse_block_into_rule_sets! with StringScanner - a more performant API for tokenizing strings.

Tenderlove had a post last year about this.

On our benchmarks this shows a 18% improvement in performance measured for overall add_block!. The code has been in production for around 3 years now, unfortunately making changes public takes additional effort.

Pre-Merge Checklist

  • CHANGELOG.md updated with short summary

Copy link
Contributor

@grosser grosser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@grosser grosser merged commit 4fc5b07 into premailer:master Jul 29, 2024
6 checks passed
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.

2 participants