-
-
Notifications
You must be signed in to change notification settings - Fork 353
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
fix: Maintain insertion of types in a package #4832
fix: Maintain insertion of types in a package #4832
Conversation
|
||
// This can not be a "Map" as this class is Serializable and therefore Sorald wants this field | ||
// to be serializable as well (Rule 1948). | ||
// It doesn't seem smart enough to realize it is final and only assigned to a Serializable Map | ||
// in the constructor. | ||
private final ConcurrentSkipListMap<String, T> map; | ||
private final ConcurrentHashMap<String, InsertOrderWrapper<T>> map; |
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.
The hash map generally performs better. The ordering of the skip list map wasn't what we wanted.
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.
Looks good to me, maybe a single nitpick
src/test/java/spoon/support/util/internal/ElementNameMapTest.java
Outdated
Show resolved
Hide resolved
Thanks, @slarse |
Fix #4827
Adjusts the
ElementNameMap
to maintain an insertion order of it's entries, which in turn allows us to maintain insertion order of contained types. This will result in a performance hit onentrySet()
due to the sorting, but I don't think it should be all that bad.If we want to improve performance further we'll need to implement a concurrent version of a
LinkedHashMap
, or something similar.@I-Al-Istannen Thoughts?