-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
Replace FxHashMap
with IndexMap
in object properties
#1547
Conversation
Test262 conformance changes:
Fixed tests (54):
|
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.
Nice! Could you add a test to check if the order of insertion of object properties is preserved? Just to make sure we don't replace OrderedHashMap
by accident with an unordered map in the future.
Benchmarks
|
|
||
/// Wrapper around indexmap::IndexMap for usage in PropertyMap | ||
#[derive(Debug, Finalize)] | ||
struct OrderedHashMap<K: Trace>(IndexMap<K, PropertyDescriptor, BuildHasherDefault<FxHasher>>); |
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.
What is the benefit of using a new struct, comparing to just a type definition? I guess it's related to Trace + Finalize implementation, right?
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.
You cannot implement foreign traits for foreign types. That's why a newtype is necessary.
Did we use sorting somewhere else? Do we need to remove that code somewhere? |
As far as I saw, we only sort the 'Index' property map, and that is not changed here. But good point, I will check to codebase for that. |
Added a test based on the 262 Found an unneeded sort that I implemented myself a few days back :D Thanks @Razican |
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.
Well done! The small improvements in performance were a nice bonus :)
This Pull Request fixes/closes #1539.
It changes the following:
FxHashMap
withIndexMap
in object propertiesBenchmarks look good for this. Minimal gains on most benches and some minimal losses.