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

Improve performance by doing an early filter #153

Closed
flaviut opened this issue Dec 6, 2019 · 3 comments
Closed

Improve performance by doing an early filter #153

flaviut opened this issue Dec 6, 2019 · 3 comments

Comments

@flaviut
Copy link

flaviut commented Dec 6, 2019

Is your feature request related to a problem? Please describe.

I'm always frustrated when I type in a query and it takes a while to return results.

Describe the solution you'd like

It'd be nice if performance was optimized. For example, the following command:

comby -o -matcher .c -jobs 8 ':[_] << :[_] << endl' . 2>/dev/null $(rg -H '<<|endl' | cut -d: -f 1 | uniq)

is way faster (30s) than this command:

comby -o -matcher .c -jobs 8 ':[_] << :[_] << endl' . 2>/dev/null

(3min).

I'm sure there's other clever ways to improve performance as well.

Additional context
Add any other context or screenshots about the feature request here.

@rvantonder
Copy link
Member

rvantonder commented Dec 6, 2019

Hi 👋

This is almost certainly because the pattern starts with :[_], which unlike grep or line-based matching, will match across newlines (i.e., entire chunks of the file) before hitting the << part. This is a known behavior (there's a documentation tip for about it) and a warning was added in a recent release #147 to warn on this type of pattern.

My guess is that if your use case is somewhat line based, starting the pattern with something like :[_.] would work better (see reference, but it may not be sufficient for your use case depending on what the expression looks like--if so, let me know, this is still an active area of improvement).

@rvantonder
Copy link
Member

@flaviut closing this for now. Future syntax improvements will help avoid the slow behavior.

@flaviut
Copy link
Author

flaviut commented Jan 15, 2020

Understood--apologies for not getting back to you earlier, I read your message but didn't get around to replying.

Very cool project, thank you for starting it and all the time you put into it :)

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

No branches or pull requests

2 participants