-
Notifications
You must be signed in to change notification settings - Fork 113
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
Freeze some collections for faster accessing #2023
Conversation
@@ -454,14 +470,14 @@ | |||
|
|||
internal void SetGlobalNativeProc(NativeProc.HandlerFn func) { | |||
var (name, defaultArgumentValues, argumentNames) = NativeProc.GetNativeInfo(func); | |||
var proc = new NativeProc(_globalProcIds[name], Root, name, argumentNames, defaultArgumentValues, func, _dreamManager, _atomManager, _dreamMapManager, _dreamResourceManager, _walkManager, this); | |||
var proc = new NativeProc(_globalProcIds![name], Root, name, argumentNames, defaultArgumentValues, func, _dreamManager, _atomManager, _dreamMapManager, _dreamResourceManager, _walkManager, this); |
Check warning
Code scanning / InspectCode
Redundant nullable warning suppression expression Warning
@@ -454,14 +470,14 @@ | |||
|
|||
internal void SetGlobalNativeProc(NativeProc.HandlerFn func) { | |||
var (name, defaultArgumentValues, argumentNames) = NativeProc.GetNativeInfo(func); | |||
var proc = new NativeProc(_globalProcIds[name], Root, name, argumentNames, defaultArgumentValues, func, _dreamManager, _atomManager, _dreamMapManager, _dreamResourceManager, _walkManager, this); | |||
var proc = new NativeProc(_globalProcIds![name], Root, name, argumentNames, defaultArgumentValues, func, _dreamManager, _atomManager, _dreamMapManager, _dreamResourceManager, _walkManager, this); |
Check warning
Code scanning / InspectCode
Possible null reference argument for a parameter. Warning
|
||
Procs[proc.Id] = proc; | ||
} | ||
|
||
public void SetGlobalNativeProc(Func<AsyncNativeProc.State, Task<DreamValue>> func) { | ||
var (name, defaultArgumentValues, argumentNames) = NativeProc.GetNativeInfo(func); | ||
var proc = new AsyncNativeProc(_globalProcIds[name], Root, name, argumentNames, defaultArgumentValues, func); | ||
var proc = new AsyncNativeProc(_globalProcIds![name], Root, name, argumentNames, defaultArgumentValues, func); |
Check warning
Code scanning / InspectCode
Redundant nullable warning suppression expression Warning
|
||
Procs[proc.Id] = proc; | ||
} | ||
|
||
public void SetGlobalNativeProc(Func<AsyncNativeProc.State, Task<DreamValue>> func) { | ||
var (name, defaultArgumentValues, argumentNames) = NativeProc.GetNativeInfo(func); | ||
var proc = new AsyncNativeProc(_globalProcIds[name], Root, name, argumentNames, defaultArgumentValues, func); | ||
var proc = new AsyncNativeProc(_globalProcIds![name], Root, name, argumentNames, defaultArgumentValues, func); |
Check warning
Code scanning / InspectCode
Possible null reference argument for a parameter. Warning
Superseded by #2031 |
Converts some collections on
DreamObjectTree
andDreamObjectDefinition
to their frozen variants. On my machine this consistently reduced Paradise round init by roughly ~2 seconds. I only compared third and fourth runs for both before & after so PGO wouldn't impact the results.Since these collections never change after JSON parsing, it's a free performance boost on any accesses for the remainder of the round.
I'll try to tackle Procs & Variables in a subsequent PR since they need a bit more wrangling.