orgzly / orgzly-android

Outliner for taking notes and managing to-do lists
https://www.orgzly.com
GNU General Public License v3.0
2.69k stars 306 forks source link

Git sync: SyncUtils.groupAllNotebooksByName(dataRepository) takes longer as history accrues #942

Open amberin opened 2 years ago

amberin commented 2 years ago

:heavy_check_mark: I have searched for existing issues that may be the same as or related to mine.

This should be investigated -- I don't know what causes it.

I suppose it could be old temp branches laying around, which requires more looping to be done at some point? Or something similar.

I have noticed a quite long delay before all notebooks have their status updated to "syncing", so it's somewhere before that.

It is definitely not related to the size of the repo history. If I delete the local workdir, and clone the same repo anew, syncing becomes much faster.

Come to think of it, this could theoretically be unrelated to Git syncing, as I cannot compare with other repo types.

amberin commented 1 year ago

I can no longer reproduce this. Closing.

amberin commented 1 year ago

Reopening this as I have run into it again.

The fetching notebooks stage takes longer and longer the longer I use a Git repo. If I remove the repo, and add it back, then fetching notebooks is snappy again. So I assume it has something to do with what builds up in my local .git directory.

So far, I have only narrowed the delay down to this place in the code: https://github.com/orgzly/orgzly-android/blob/master/app/src/main/java/com/orgzly/android/sync/SyncWorker.kt#L160

I will try to do some profiling the next time the problems re-appears.