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

Consider moving constant regexes to use constants #809

Open
hasezoey opened this issue Oct 10, 2023 · 0 comments
Open

Consider moving constant regexes to use constants #809

hasezoey opened this issue Oct 10, 2023 · 0 comments

Comments

@hasezoey
Copy link
Member

I have recently learned that regexes get re-created *1 every time they are executed, unless they are stored in a constant, so this could (at least slightly) improve performance by not having to re-compile the regexes everytime a line is checked, though i have not measured performance..

*1 apparently it is only compiled once but every time they are executed a new regexp object is created and needs to be gb collected

MDN Guide: Regular Expressions
also see this stackoverflow thread

probably should do some measurements just to be sure, but from my slight look it should be at least somewhat better for V8

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