Re: idleStreams

Michael Herger <slim-b/[email protected]> Mon, 7 Nov 2022 08:43:48 +0100
Newsgroups gmane.music.equipment.slimdevices.devel
Message-ID <[email protected]>
> More testing (exec times) shows that the exec times are more or less
> what I should expect considering the SQLite track limit (4000), the size
> of my (artificially upscaled) library (500.000), and the performance of
> my 10+ year old hardware. So 4000 out of 500000 using the '*-Songs -
> random- dynamic playlist SQLite code*'
> (https://github.com/AF-1/lms-dynamicplaylists/blob/main/DynamicPlaylists3/Playlists/songs/songs_01_random.sql)
> => ~32 secs. I got ~2 mins exec time when I split those 4000 into chunks
> of 200 (= multiple SQLite queries). Sorry for the confusion.

Wow... that's a massive query. I understand there are some placeholders 
in there which I assume get replaced at run time.

One potential problem I'm seeing there is that you join tables you don't 
always need. And you join them on the main select, which means, before 
filtering out any tracks you didn't want to have at all.

Which leads me to another one: you query the tracks several times. You 
do it in the main select, and then again for each hit in the main 
select. Which means you might be querying it hundreds of thousands of 
times with your test table.

But if a track must not exist in a certain selection, why not put that 
criteria first? You could store the reversed result of the genre filter 
(the sub query) plus duration in a temporary table, and use that 
temporary table to apply the remainder of the filtering and ordering, 
which require the expensive joins. That way the joins would only be done 
for a reduced number of tracks, and you wouldn't hit the tracks table 
over and over again.

> I've browsed the code of other plugins with scanner/importer code. What
> plugins like iTunes, fulltextsearch or even my own RatingsLight... put
> in their importers actually makes sense in the scanner context because
> they import stuff into the db or modify db contents. My function is just
> about creating a static playlist (file).

Yeah, I got that. Launching your own process might be a working solution 
on unixy platforms, but a no-go on Windows...

> P.S. Do you know how to get the nice input slider (*sliderinput*) (for
> numeric input values in the settings UI) in the main/player UI (LMS
> default skin)?

You define a class "sliderInput_XX_YY", where XX is the minimum, and YY 
the maximum. See eg. 
https://github.com/Logitech/slimserver/blob/public/8.4/HTML/EN/settings/server/interface.html#L43