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

Replace "lock" preg_replace with state machine enhancements #114

Open
tedivm opened this issue Mar 4, 2023 · 0 comments
Open

Replace "lock" preg_replace with state machine enhancements #114

tedivm opened this issue Mar 4, 2023 · 0 comments

Comments

@tedivm
Copy link
Member

tedivm commented Mar 4, 2023

The "lock" functionality explicitly locks certain patterns in place, such as "asd" + ++x;. If the plus signs in that example were to merge into one string ("asd"+++x;) it would cause an error with the javascript.

When this bug was discovered we took the easy way out and replaced the pattern with a special string. This was done with a preg_replace across the whole string. The performance on this is pretty garbage.

To resolve this properly the "+ ++" pattern would be detected inside of the state machine that generates the minified string. Placing it in there would prevent the additional preg_replace scan, and would allow us to skip the "add back" portion of the code. This would provide a significant performance boost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant