felko / neuron-mode

An emacs mode for editing Zettelkasten notes with neuron
GNU General Public License v3.0
118 stars 21 forks source link

Non blocking cache regeneration is very slow #51

Open felko opened 4 years ago

felko commented 4 years ago

In https://github.com/felko/neuron-mode/commit/09e1f47013cb0fd70e9878713c8b3a4c62c08c2f, I made neuron-refresh run in a thread to avoid blocking Emacs which isn't necessary. However, I noticed that it slowed down cache regeneration by a very large factor (I don't know how much exactly but easily x10).

I have no idea what is causing this, I don't know how emacs lisp threading works internally.

Unless someone finds a fix for this, we have three options:

srid commented 4 years ago

I might have to play with this to see what happens.

Most likely I think neuron will have be optimized for the incremental case (one file changed; then fast update of graph cache on disk).

srid commented 4 years ago

https://github.com/srid/neuron/issues/321

felko commented 4 years ago

Thanks for looking into this. This will indeed improve the performance but I'd still like some way to speed up the cache regeneration from emacs which is unreasonably slow. I was thinking that I could use an asynchronous process (start-process-shell-command) instead of spawning an emacs thread.