-
Notifications
You must be signed in to change notification settings - Fork 21
New implementation of LinkedHashSet/LinkedHashMap #11369
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
Comments
@szeiger would you approve this? |
I haven't paid much attention to LinkedHashMap so far. I think any performance improvement would be welcome, especially if we can share code again with the new HashMap implementation. |
I would like to contribute here. |
@mghildiy it's all yours if you want it 😄 |
Is this still under consideration for RC1? |
I went through mutable.HashMap and found changes broadly as:
|
"changes" is an understatement - it's a completely new implementation. I think the idea here is to start with a copy of the new HashMap implementation and make the required changes for keeping track of the links. |
Thanks for the inputs. |
I would also like to contribute if there's need for it. |
Some methods like writeObject, readObject are never called in current implementation of LinkedHashMap. |
@mghildiy actually those methods are being used, these are kind of "magic methods" that Java knows to call during Java serialization/deserialization. Also I would recommend not extending hashmap to implement linked hash map, but maybe some of the hashtable code can be factored out for reuse. |
OK, so you mean a better approach would be to pull out reusable code from mutable.HashTable into a class/object and use it in classes wherever needed, like those enlisted in original post. |
As far as I understand, new implementation of HashMap/HashSet no more has hashtable related code. |
Hi, Any more inputs here? |
@mghildiy If I were doing it, I would simply copy paste |
@mghildiy the first step to changing the Let me know if you have any more questions 😄 |
Thanks for the inputs @joshlemer . Would look into it this weekend. |
There are some methods,like apply, which are not implemented in current version of immutable.LinkedHashMap, but they are there in immutable.HashMap. |
you mean because the implementations are inherited? in many cases the inherited implementations are fine and there's no reason to override them. concrete collections may override some of them, usually for efficiency |
Sorry, my mistake. I was actually referring to mutable versions, not immutable.. |
I am done with changes in LinkedHashMap. |
No not necessarily,
I think if you just get all existing LinkedHashMap tests to pass, that should be enough to put up a preliminary |
👋 I haven't seen a PR for this yet. As we're closing in rapidly on the RC1 due date, I'm going to have to defer this unless we can have a PR in a mergeable state this week or early next. |
I am facing 2 test failures for my change. Trying to find the cause. |
@mghildiy sounds good enough for a WIP PR, maybe if we take a look at it, it'll be obvious to somebody where the failures might be coming from |
I would create a PR in next 2-3 days. |
right, or you can use GitHub's new "draft" feature, https://github.blog/2019-02-14-introducing-draft-pull-requests/ |
Draft PR: |
Thanks a bunch @mghildiy 😄 |
It seems this PR won't be ready this week, which is the deadline for RC1. I'm going to put this on the backlog, since it doesn't sound like something we could do in 2.13.1. I haven't followed in detail, so please correct me if I'm missing something. |
the PR seems abandoned...? perhaps someone else would be interested in picking it up? |
Recently, @szeiger rewrote the implementations of
mutable.HashMap
andmutable.HashSet
here. So far as I see there's no reason not to implement LinkedHashSet/Maps the same way, and in fact doing so will allow LinkedHashMaps/Sets to participate in hashcode sharing between:s.c.i.HashMap
s.c.i.HashSet
s.c.i.VectorMap
s.c.m.HashMap
s.c.m.HashSet
s.c.m.HashMap#keySet
s.c.i.HashMap#keySet
s.c.i.VectorMap#keySet
as started here
The text was updated successfully, but these errors were encountered: