Skip to content

Conversation

VReaperV
Copy link
Contributor

Removes most of the reallocations that happen because the file size is not known in advance.

This decreases the load time at start-up by easily 2x, and slightly improves load time for maps.

@VReaperV
Copy link
Contributor Author

Added the same fix for opus files too.

@illwieckz
Copy link
Member

Very nice!

@VReaperV
Copy link
Contributor Author

I'm not sure what the hell happened with CI there, it never actually ran anything, and the only change I made was rebasing on master.

Copy link
Member

@slipher slipher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This decreases the load time at start-up by easily 2x

Are you sure you're not accidentally measuring the difference between the 2 randomly selected menu soundtracks? One takes around 0.2s to load, and the other around 0.9s.

In any case, it did make a nice ~10% improvement for LoadOggCodec in my tests.

Master, short soundtrack (heartbeat1.ogg)
SoundLoader-ext N=10 min=215355us max=261480us avg=243623us tot=2436236us

This branch, short soundtrack
SoundLoader-ext N=10 min=172695us max=232609us avg=217946us tot=2179463us

Master, long soundtrack (heartbeat.ogg)
SoundLoader-ext N=10 min=820111us max=1047663us avg=921785us tot=9217856us

This branch, long soundtrack
SoundLoader-ext N=10 min=779843us max=934458us avg=837928us tot=8379280us

@VReaperV VReaperV force-pushed the fix-audio-allocs branch 2 times, most recently from 929e1cd to 0de548c Compare August 30, 2025 19:45
Removes most of the reallocations that happen because the file size is not known in advance.
@slipher
Copy link
Member

slipher commented Aug 31, 2025

LGTM

@VReaperV VReaperV merged commit 1b44603 into DaemonEngine:master Aug 31, 2025
9 checks passed
@VReaperV VReaperV deleted the fix-audio-allocs branch August 31, 2025 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants