Skip to content

Patched performance bug in quickload behaviour#1340

Open
tayloroxelgren wants to merge 1 commit into
JACoders:masterfrom
tayloroxelgren:quickload-improvement
Open

Patched performance bug in quickload behaviour#1340
tayloroxelgren wants to merge 1 commit into
JACoders:masterfrom
tayloroxelgren:quickload-improvement

Conversation

@tayloroxelgren

Copy link
Copy Markdown

This fixes what appears to be a quickload performance bug in Jedi Outcast single player.

During JK2 SP sound precache, the loading screen text was updated for nearly every sound entry :

if (i&31) {
    CG_LoadingString( soundName );
}

I believe this was just a long standing bug as the Jedi Academy code has similar code but it is written like so.

if (!(i&7)) {
      CG_LoadingString( soundName );
}

In my local testing, it resulted in a 20-25% reduction in quickload times and 2-5% for cold loads.

@tayloroxelgren tayloroxelgren requested a review from a team as a code owner June 30, 2026 07:28
@ensiform

Copy link
Copy Markdown
Member

There is no real measurable performance gain here that I can tell. Flipping the logic from 31 out of 32 sounds to only printing every 32 sounds doesn't save very many draw calls. It does not result in fewer registrations being made which is what really takes the time on load.

@tayloroxelgren

Copy link
Copy Markdown
Author

I just reran the quickload test with and without this change.

Each case was run 10 times on kejim_post.

Without change:

TOTAL LOAD TIME avg  : 483.2ms
CG_RegisterSounds total avg : 132.0ms

With the change:

TOTAL LOAD TIME avg : 359ms
CG_RegisterSounds total avg : 8ms

I agree it doesn't reduce the number of registrations. The difference comes from reducing CG_LoadingString() calls during quickload when the sound registration has already been cached. So just calling CG_LoadingString() and updating the screen is inflating the quickload time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants