Open serjflint opened 2 years ago
Obvious suspect is guess_show with SequenceMatcher
I created a dirty hack to scan only currently watching titles instead of the whole library when scan_whole_list is disabled.
We should scan everything in a separate thread and collect the result after it finishes.
We should scan everything in a separate thread and collect the result after it finishes.
It solves the symptoms, but not the cause. There are many optimizations to find the match than just brute-force seeking longest common sub-sequence of each file and each title.
Indeed, matching is quote slow especially when there is no match for a file.
I created a dirty hack to scan only currently watching titles instead of the whole library when scan_whole_list is disabled.
It is not scanning the whole library, just watching, on hold and plan to watch, as you can see here:
https://github.com/z411/trackma/blob/master/trackma/lib/libmal.py#L53
If the API doesn't present this variable, it will use statuses_start, which is indeed only Watching in most cases.
@z411 sorry, I said it incorrectly. I agree, it is not the whole library. But in my case the difference is negligible. I have 90% of titles in "plan_to_watch". For 2k titles the current brute-force algorithm is horribly slow. I mentioned some ideas above.
Limiting the candidates is what's being done now, but I think the main fix would be to make the algorithm faster. As my list was never too big I never noticed horrifying performance but admittedly Taiga is a lot faster even though it's scanning the whole list; we really need to take from that. Or maybe it's not that faster, it's just that as @ahmubashshir said it's being done in a separate thread so it's not noticeable. But 121 seconds is indeed a ton. The algorithm needs to be improved.
Clicking Rescan Library (full) eats one core 100% for several minutes and the QT interface barely responds at the time. I have ~4k titles in total on the lists but barely 100 files on the disk.
Manjaro Linux Trackma-qt 0.8.4