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

Optimize the url filter by using non-capturing regex groups #2918

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

Conversation

borissmidt
Copy link

@borissmidt borissmidt commented Jan 19, 2025

It seems especially the URL_PATTERN couldn't be optimized by the regex compiler because all groups are capturing.

I was originally looking at the golang ide console speed and there one of the heavy filter plugins is the GoConsoleFilter but i can't really update the code to try the differences.

But i see the complictated regex where not all matching groups are used. So i suspect this gives a similar issue to the URL regex change i do here.

(this is in the GoConsoleFilter)

MESSAGE_PATTERN = Pattern.compile("(?:^|\\s)(?<slog>source=)?(?<filename>\\S+\\.\\w+):(?<line>\\d+)(:(?<col>\\d+))?(?=[:\\s]|$).*");

@trespasserw
Copy link
Member

Unfortunately, those are public fields with both internal and external (i.e., by 3rd-party plugins) usages relying on the group numbers, so we can't just change the patterns.

Re GoConsoleFilter -- could you please file an issue at https://youtrack.jetbrains.com, possibly with a CPU profile attached?

@borissmidt
Copy link
Author

I've created a ticket:
https://youtrack.jetbrains.com/issue/GO-18089/improve-terminal-speed-for-GoConsoleFilter

Unfortunately, those are public fields with both internal and external (i.e., by 3rd-party plugins) usages relying on the group numbers, so we can't just change the patterns.

As an alternative could we deprecate the existing ones and create a '_V2' version which should be used instead?

Or to limit the scope, these new regexes could be used just in the PatternBasedFileHyperlinkRawDataFinder.

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