-
Notifications
You must be signed in to change notification settings - Fork 125
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
Open
Ruzihm
wants to merge
16
commits into
OpenDreamProject:master
Choose a base branch
from
Ruzihm:ListSpeedupSmallChange
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added assertions to validate list behavior and contents.
… refvalue memory locationi f dealing with dreamobjects
…eference cache in classes where it isn't synchronized
Collaborator
|
This PR takes my Paradise Station second-run round init time from 130.2s to 124s. |
Contributor
Author
|
@ike709 If you don't mind checking again, how much more memory does it use with this PR? |
Contributor
|
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.