Re: idleStreams

Michael Herger <slim-b/[email protected]> Mon, 7 Nov 2022 13:27:10 +0100
Newsgroups gmane.music.equipment.slimdevices.devel
Message-ID <[email protected]>
I think what might take the most time is randomization. I've tested with 
a 100k library on a M1 Mac. Results won't compare to your testbed, but 
it might give an idea.

I did a select filtering out genres, tracks shorter than five minutes. 
Basically your query less the DPL specific and libraryview filtering. It 
takes roughly 40ms to complete and randomize. Without the randomization 
it's <1ms. Sure, this depends on the size of result set etc.

One workaround _might_ be (to be tested) to sacrifice some randomness in 
favor of performance: track IDs are numerical, increasing values. You 
can easily get the largest and the smallest number. Create random values 
in that range and select just that one track in a loop.

As I said: I'm not sure this is any faster than randomizing the full 
result set. But it would avoid creating a (background) copy of the table 
for the randomized values.