osudroid / osu-droid

http://osudroid.moe
Apache License 2.0
507 stars 76 forks source link

Library rework to support multithreading #241

Closed ammarasyad closed 1 year ago

ammarasyad commented 1 year ago

LibraryManager loads and caches beatmaps synchronously and single-threaded, which causes long caching times as most of the time is spent on a single thread while the rest of the CPU does nothing. This PR reworks the loading operation to utilize all available cores to cache as fast as possible.

The class is also converted into an enum singleton to provide a thread-safe singleton to prevent any concurrency issue. Any references to LibraryManager are updated accordingly.