Skip to content
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

Improve hashing logic in ScriptableObject for collision resistance. #328

Closed
wants to merge 3 commits into from

Conversation

gbrail
Copy link
Collaborator

@gbrail gbrail commented Sep 22, 2017

See the commit log and related issue #290 for more information.

This is a big change with big implications, but it seems to be holding up well. V8 benchmarks as well as microbenchmarks are very close to the way that they were before and any differences seem to be generally lost in the noise.

Move existing hashing code from ScriptableObject to a new class
called EmbeddedSlotMap, which is optimized for fast runtime
performance.

When the size of a particular object passes a threshold, move
all of the slots from that to the HashSlotMap class, which uses
java.util.HashMap under the covers.

This preserves nearly the same performance as the current implementation
when objects are the size of the vast number of objects in JavaScript.

However, when objects contain keys with thousands or tens of thousands
of hash collisions, java.util.HashMap will switch to a tree-based
data structure in order to preserve reasonable performance.
@gbrail
Copy link
Collaborator Author

gbrail commented Oct 4, 2017

Replacing with a more comprehensive version.

@gbrail gbrail closed this Oct 4, 2017
@gbrail gbrail deleted the greg-hashing-6 branch December 22, 2017 18:39
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.

1 participant