Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@Root slowdowns when these collections grow bigger, possibility of collisions. Hashes of identical objects between 2 JVMs are not guaranteed to be identical.
-
Root797675y@netikras Fair. There are definitely edgecases.
I haven't experienced slowdowns on large hashes though. Why would this happen? -
@Root hashmap in java does iterate over a list of entries comparing their hash:long field value to provided object's hash value. This iteration causes O(n). My array is almost O(1) :)
-
Root797675y@netikras That's a terrible hash implementation 😅
It's supposed to be O(1) by design!
But your array implementation sounds amazing. Good work! -
@netikras
Just fyi, it used to be O(n) but isn't anymore:
"To address this issue, Java 8 hash elements use balanced trees instead of linked lists after a certain threshold is reached, [...] which will improve the worst case performance from O(n) to O(log n)."
(https://geeksforgeeks.org/internal-...)
I always wanted to have an array where I could store an object at index 694307084175882649501.
And now I can!!!
random
performant data structures