You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to profile the scanning process and noticed some less than ideal behaviour for larger libraries.
Firstly setText() seems to be using about 30% of cpu time on the main thread just updating the "Loading your music library... (xxx/xxx)" text. Secondly a rescan launches thousands of threads.
I tried using a threadpool executorservice in exoplayer/upstream/Loader, this about halved the threads created but it didn't affect wall-clock-time and android studio is so miserable and buggy it's hard to know if it improved cpu usage (I think it did though).
I don't know enough about android event loops to work out how to change exoplayer/MetadataRetriever to use a thread pool. That bit of code seems terribly complicated and designed for a different use case such as async retrieval of metadata from a small number of remote sources and not thousands of local files.
So I didn't have much luck improving performance, although I might suggest removing the numbers from "Loading your music library ... (xxx/xxx)" since all they do is jump around annoyingly and don't tell the user anything useful.
I did notice the following comes up a few times during a rescan in the unmodified version. I couldn't identify what causes it.
Handler (android.os.Handler) {5a20ac4} sending message to a Handler on a dead thread
java.lang.IllegalStateException: Handler (android.os.Handler) {5a20ac4} sending message to a Handler on a dead thread
at android.os.MessageQueue.enqueueMessage(MessageQueue.java:567)
at android.os.Handler.enqueueMessage(Handler.java:754)
at android.os.Handler.sendMessageAtTime(Handler.java:703)
at android.os.Handler.sendMessageDelayed(Handler.java:673)
at android.os.Handler.post(Handler.java:403)
at androidx.media3.exoplayer.source.ProgressiveMediaPeriod.onUpstreamFormatChanged(ProgressiveMediaPeriod.java:721)
at androidx.media3.exoplayer.source.SampleQueue.format(SampleQueue.java:594)
at androidx.media3.extractor.mp3.Mp3Extractor.readInternal(Mp3Extractor.java:277)
at androidx.media3.extractor.mp3.Mp3Extractor.read(Mp3Extractor.java:242)
at androidx.media3.exoplayer.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:133)
at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1067)
at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:433)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Describe the intended behavior
Better cpu usage and running time.
What android version do you use?
Android 13
What device model do you use?
pixel 4a with lineagos 20, but also a motog8+ with android 10.
Describe the Bug/Crash
I was trying to profile the scanning process and noticed some less than ideal behaviour for larger libraries.
Firstly setText() seems to be using about 30% of cpu time on the main thread just updating the "Loading your music library... (xxx/xxx)" text. Secondly a rescan launches thousands of threads.
I tried using a threadpool executorservice in exoplayer/upstream/Loader, this about halved the threads created but it didn't affect wall-clock-time and android studio is so miserable and buggy it's hard to know if it improved cpu usage (I think it did though).
I don't know enough about android event loops to work out how to change exoplayer/MetadataRetriever to use a thread pool. That bit of code seems terribly complicated and designed for a different use case such as async retrieval of metadata from a small number of remote sources and not thousands of local files.
So I didn't have much luck improving performance, although I might suggest removing the numbers from "Loading your music library ... (xxx/xxx)" since all they do is jump around annoyingly and don't tell the user anything useful.
I did notice the following comes up a few times during a rescan in the unmodified version. I couldn't identify what causes it.
Describe the intended behavior
Better cpu usage and running time.
What android version do you use?
Android 13
What device model do you use?
pixel 4a with lineagos 20, but also a motog8+ with android 10.
Bug report
as above.
Duplicates
The text was updated successfully, but these errors were encountered: