What causes Logseq to consume increasing amounts of CPU over time?

I am running Logseq on an M1-powered iMac running the latest Ventura beta. I have Logseq always on, as it is my goto app for note-taking, todo lists and time-tracking. I have noticed that the longer I keep Logseq running, the more CPU time it seems to consume. After a few days, CPU load creeps up to 100% for minutes on end, even when Logseq is just sitting idle in the background and hasn’t been touched by me for hours.
I have discovered that - apart from closing and restarting Logseq - the best (and relatively painless) way of getting Logseq to calm down is to re-index my graph. For some reason, that dramatically reduces the CPU time being consumed going forward.
While it is good to know this trick, I wonder what exactly could be causing this behaviour? Could it be a matter of cleaning up the in-memory database Logseq uses that so dramatically improves its performance after a re-index? Or could there be some rogue processes spinning up over time that are not properly stopped until a re-index is executed?
It would be nice to know the underlying reasons for this behaviour, so I can better manage Logseq’s load on my system. Also, if we know what is causing it, maybe future versions can have inbuilt load-management features. I wouldn’t mind, for instance, if rising CPU usage while being idle would trigger Logseq to do a re-index automatically in the background, as a kind of garbage collection, similar to what we used to have in the programming environments I used to work in (I haven’t done any programming in a long, long time, so I don’t know if garbage collection is still a thing).

Any thoughts, anyone?

6 Likes