-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Why LinkedHashMap? #44
Comments
Can you link the part of Glide you're talking about? Assuming you mean for the lru memory cache, performance aside, we need the linked list to be able to tell which images we want to discard when our cache grows too large. Although it's certainly less performant than simpler maps, it's vastly more performant to use the linked list rather than try to use some other scheme to keep track of what to remove next. It's also worth noting that in the grand scheme of things, even a 10x increase in the amount of time it takes to get or put from a map is likely to be insignificant relative to all of the other things that have to happen for an image to be loaded into memory and displayed. |
Understood |
What about CocurrentLinkedHashMap? |
Essentially because it's not in the standard libraries. There does appear to be an open source version, but the performance gain probably wouldn't be worth the additional dependency. If you're curious and want to try integrating it, please do feel free to do so and run some benchmarks. I'm not against the idea if there are significant performance gains. |
Why not just use HashMap?
The reason I ask is because I looked at some benchmarks here:
http://www.artima.com/weblogs/viewpost.jsp?thread=122295
The text was updated successfully, but these errors were encountered: