Closed qingshuizheng closed 9 months ago
An even faster solution for ekg--transclude-titled-note-completion
is to cache ekg-document-titles
. But that needs some sweats, and I don't use it for the moment, 1.50 seconds (in my old macbook pro) to finish an ekg-document-titles
call is decent enough for me after this change.
Just realize we could do the same for ekg-show-notes-in-trash
.
Please wait a sec, I will push another commit later.
I force-pushed a commit including:
delete-dups
-> seq-uniq
ekg-show-notes-in-trash
curates note ids of trashed note.Thank you for these fixes, they make a lot of sense. I think you must have the largest repository, so you seem to be running up against these perf problems first. Let me know what else you find!
Let me know what else you find!
Sure! Thanks for the review.
Background:
Func
ekg-document-titles
&ekg-active-note-ids
go through loads of ids one-by-one to check if an id is active withekg-active-id-p
, which is really expensive and takes a long time to finish for a large database.That makes it really struggling to use funcs that rely on the check, for example,
ekg--transclude-titled-note-completion
, which depends onekg-document-title
to refresh candidate list on every input.--
Comparison of two functions filtering active note-ids:
Old func:
New func:
-- Test: if elements filtered by the above two are the same:
-- Benchmark (rough) on my personal triples.db
record number: 32702 title number: 2401 tag number: 2566 note containing tags: 1728 note containing text: 2566
As indicated above, the new method is way way way faster than the original. So this commit re-adapts the related code to the new method.
Note: The benchmark could be biased, since my db has no more than 10 draft/trashed notes.
Update: formating