Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Subsong performance issues in v2.x (Read 371 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Subsong performance issues in v2.x

Subsong performance issues in v2.x

Hi, I've noticed an issue with subsongs in v2.x (up to latest preview) vs v1.x, which affects performance in foo_input_vgmstream for files with subsongs (esp. some bank formats, which may contain several thousands).

When adding a new file with subsongs, these methods get called:
- get_subsong_count(): returns number of subsongs
- per subsong:
  - get_subsong(..): matches current index vs internal subsong number
  - get_info(..): queries info for current subsong
Then all subsongs get added to playlist with queried info. This works the same in 1.x and 2.x.

When playing a single subsong, this happens in v1.x:
- get_subsong_count()
- per subsong:
  - get_subsong(..): a bit odd it's re-called again per subsong rather than current index, but no matter
- decode_initialize(..): for current index (ex. subsong 3)
- get_info(..): for current index, to update current info I assume

However this happens in v2.x:
- get_subsong_count()
- per subsong:
  - get_subsong(..)
  - get_info() !!!
- decode_initialize(..)
- get_info(..)
So if any subsong is played, foobar re-queries all info for *all subsongs*, every time a subsong is played.

vgmstream only has info for current subsong (assumes players will only ask for 1 at a time) so it's slow to re-query all subsongs on every play. But even if we manually cache'd that, seems like a bug as I don't think there is need to re-ask about other subsongs when only trying to play one.

Could be that vgmstream isn't doing something that foobar expects too, code here is somebody has suggestions:
https://github.com/vgmstream/vgmstream/blob/master/fb2k/foo_vgmstream.cpp

Re: Subsong performance issues in v2.x

Reply #1
Indeed, asks decoder for all infos even if they're not actually needed. This was NOT intended.
Fixed for the next update, thanks for reporting.
Microsoft Windows: We can't script here, this is bat country.