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

Make regex matcher timeout configurable #638

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexbakker
Copy link

I use chroma to syntax highlight code snippets on my blog. While profiling my
static blog generator, I noticed that a lot of time was being spent setting up
the regex timeout watcher: https://alexbakker.me/u/g987wpgo1v.svg.

I'm not exactly sure why it's spending so much time there, but disabling the
timeout results in a 2x performance improvement in my testing.

lexer.go Outdated Show resolved Hide resolved
@alexbakker alexbakker force-pushed the optional-timeout branch 2 times, most recently from 05319db to 275483e Compare October 8, 2022 10:02
@alecthomas
Copy link
Owner

Apologies, I lost track of this. I didn't think of this at the time, but this will have to be an optional interface to avoid breaking API compatibility.

I use chroma to syntax highlight code snippets on my blog. While profiling my
static blog generator, I noticed that a lot of time was being spent setting up
the regex timeout watcher: https://alexbakker.me/u/g987wpgo1v.svg.

I'm not exactly sure why it's spending so much time there, but disabling the
timeout results in a 2x performance improvement in my testing.
@alexbakker
Copy link
Author

alexbakker commented Nov 12, 2022

No worries. I've removed the interface change entirely for now. Perhaps it makes more sense to hold off an adding an optional interface until we see more lexers that could support setting a timeout.

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.

None yet

2 participants