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

Use ripgrep if installed #119

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

Use ripgrep if installed #119

wants to merge 1 commit into from

Conversation

mithraen
Copy link
Contributor

No description provided.

@l3kn
Copy link
Owner

l3kn commented Dec 20, 2023

In case you're using the cache-mode of org-fc, is that still working as expected with ripgrep?
I remember running into some issue when I last tried rg instead of find but I can't replicate it yet.

What do you think about adding some configuration option for which program to use, so users an opt to use find even if they have a rg executable? Maybe also a way to pass custom flags to the arguments.

Assuming rg is faster on average, we could add some default 'auto setting which will use rg when available and find otherwise.

@mithraen
Copy link
Contributor Author

'find' would be faster, if all files in dir are files with flash cards.
'rg' would be faster, if only some of files in dir are files with flash cards.

In my setup it's about 10x speedup with rg.

Do we really need to separately speedup case, when someone have thousands of files, and all of them with org-fc?

I don't use cache mode of org-fc, and doesn't know about it :( Where I can find documentation?

@l3kn
Copy link
Owner

l3kn commented Dec 20, 2023

Sorry, it seems like I never added documentation for the cache. It can be enabled or disabled with M-x org-fc-cache-mode.

A big reason why find is slower than rg is that it does not filter for files with flashcards.
This can be changed by including a -exec grep for :FC_CREATED: but the command will get very complicated.

Maybe my preference for find comes from the problems I had with rg but I'll try switching to rg and see if that runs into any issues.

@mithraen
Copy link
Contributor Author

I remove autodetect and change it to defcustom.

P.S. cache mode broken by last commit to it -- org-fc-awk-index-paths used but not defined. Is it typo, last dash must be space?

@l3kn
Copy link
Owner

l3kn commented Dec 28, 2023

Seems like I messed up something with the cache and only fixed it on the develop branch, sorry for that.

If I remember correctly, org-fc-awk-index-paths was intentional and designed to work around an issue when building the cache for the first time and potentially passing a list of thousands of files to awk. I'll try to find the missing function and test your ripgrep commit with that.

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