l3kn / org-fc

Spaced Repetition System for Emacs org-mode
https://www.leonrische.me/fc/index.html
GNU General Public License v3.0
258 stars 31 forks source link

Use ripgrep if installed #119

Open mithraen opened 8 months ago

l3kn commented 8 months ago

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 commented 8 months ago

'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 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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.