You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HashMap.HashMap1 lazily initializes and then caches the key value pair kv. So it keeps redundant information, presumably to avoid creating key value pairs when repeatedly iterating over all elements.
From my experience, short-lived objects are very cheap on the JVM while long-lived objects come with a larger penalty. In addition, keeping redundant information significantly complicates the code and has the potential to become inconsistent, which has already happened in this case.
So it should be investigated if it is really worth it to keep kv around, or if the code could be simplified by either
removing kv and creating it on demand
storing just kv and getting key and value from kv when needed
The text was updated successfully, but these errors were encountered:
#11077 may be deemed a proper follow-up to the linked ticket on merged, namely, that the new implementation is efficient and free of brittle redundancy.
#12400 remains as a caution to anyone attempting to open wormy cans.
Closing as unplanned (stale) with respect to 2.12.
HashMap.HashMap1 lazily initializes and then caches the key value pair kv. So it keeps redundant information, presumably to avoid creating key value pairs when repeatedly iterating over all elements.
From my experience, short-lived objects are very cheap on the JVM while long-lived objects come with a larger penalty. In addition, keeping redundant information significantly complicates the code and has the potential to become inconsistent, which has already happened in this case.
So it should be investigated if it is really worth it to keep kv around, or if the code could be simplified by either
The text was updated successfully, but these errors were encountered: