-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix EntityWhitelist causing huge performance drop #33322
base: master
Are you sure you want to change the base?
Conversation
Wait wait wait It checked the registrations every single time something was trying to validate? I’m guessing the huge performance hit is it causing shitton of errors and thus having to do terminal IO which is notoriously awful when spamming stuff…? Er, unless it doesn’t in fact spam? Not quite in position to check the behavior right now. Oh and the constant lookups don’t help probably |
Yuuuup.. |
|
||
foreach (var registration in _factory.GetAllRegistrations()) | ||
{ | ||
_componentCache[registration.Name] = (ComponentAvailability.Available, registration); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't a frozendictionary going to be faster than this
* Back to baseline * space-wizards/space-station-14#33322 * PartOne * Restore recycler yml * Pirate bounty touchups, humanprofileeditor * mail component fix, ID field name * IdDataField attributes * Cargo market whitelist --------- Co-authored-by: Whatstone <[email protected]>
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
About the PR
optimizes EntityWhitelistSystem by caching component registrations
Why / Balance
EntityWhitelist would kill server performance the instant you had an entity with an invalid component name
from a trace:
Technical details
component registration caching:
_componentCache
dict to store component availability and registrationimproved registration handling:
EnsureRegistrations
method to convert strings to registrations once and cache resultsStringsToRegs
methodoptimized validation flow:
You can test it yourself with this, just put it in Content.Shared:
Media
holy shit
Requirements
Breaking changes
Changelog
no fun