-
Notifications
You must be signed in to change notification settings - Fork 127
DreamList membership reverse lookup #2476
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
base: master
Are you sure you want to change the base?
Conversation
Added assertions to validate list behavior and contents.
… refvalue memory locationi f dealing with dreamobjects
…eference cache in classes where it isn't synchronized
|
This PR takes my Paradise Station second-run round init time from 130.2s to 124s. |
|
@ike709 If you don't mind checking again, how much more memory does it use with this PR? |
|
an issue I see is memory seeing as the dictionary probably uses about 24 bytes per entry with 100000 entries being about 2.4mb (which doesnt seem that bad for a slight speed increase) |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This PR expands on the work done by @redmoogle in #2418 in speeding up dreamlist
ContainsValueby adding a reverse lookup for list membership checking.It comes with a logic fix, some overriding of contains in child classes of
DreamListwhich don't keep the lookup synchronized, and an alist fix to supportalist += 1at runtime which was run into during testing.I agree with @wixoaGit that a proper fix for #2367 will involve changing
Equalsand a new GC but I do notice that caching membership in this way substantially speeds up theinoperator for code which makes frequent checks for list membership within, exceeding the speed of byond's list implementation. So I wonder if it is worth including anyway.I tested performance changes with the following verb. Alist was included as point of comparison, its performance should not be affected by changes. Although I did notice that a change was needed to support
alist += 1and that is in this PR too. I can submit that as a separate PR if this one doesn't go anywhere but it was needed here for the comparisonResults Byond:
Results OD before changes:
Results OD after changes:
This was a pretty "optimistic" test and doesn't really examine what overhead might be introduced by this PR so I'm curious if anyone can recommend a good way to test that.