Skip to content

Potential fix for slow roundstart - #39474

Draft
Inorien wants to merge 1 commit into
vgstation-coders:Bleeding-Edgefrom
Inorien:batch_sql_lookup
Draft

Potential fix for slow roundstart#39474
Inorien wants to merge 1 commit into
vgstation-coders:Bleeding-Edgefrom
Inorien:batch_sql_lookup

Conversation

@Inorien

@Inorien Inorien commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

What this does

Batches the DB queries at roundstart

Recently there have been issues where the roundstart timer runs down to 0 but then the game doesn't actually start for another couple of minutes. Looking at logs found that all of the time is spent in the character creation loop, which involves one DB query per player. IF the situation is that the lookup round-trip time is slow (e.g. 5 seconds) and doing this once each for 24 players (= 120 sec) then this PR will reduce the lookups to 1 and the total time on a single round-trip (5 seconds) rather than the O(N) stuff we have now. This change only affects the lookups for readied players at round start and has no effect on latejoins

(apparently its generally good practice to batch these types of queries anyway)

If the problem is not the round-trip time but instead the DB itself is slow, for some other reason, this won't have much of an effect at all beyond just allegedly better practices in SQL lookup

In any case I believe this to be an environment issue more than anything

Why it's good

slow round start bad, the Gamers become Upset

How it was tested

it isn't yet. I need to set up this local DB shit to test it properly and its a pain in the ass

Changelog

🆑

  • bugfix: Possibly fixed slow round start

@SECBATON-GRIFFON

Copy link
Copy Markdown
Contributor

i think there's a pointlessly nested for loop in the role assignment procs you can check for, last i remember. will update with findings if i actually see it again.

@aacovski

aacovski commented Jul 4, 2026

Copy link
Copy Markdown

i think there's a pointlessly nested for loop in the role assignment procs you can check for

There are a lot of loops that could probably be removed. I was only able to elimate a couple

Would be faster to query all players at once (unless memory constraints, then batch). Unfortunately untangling a million loops might be difficult. Good luck

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.

3 participants