-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Added initial size for HashMaps #1343
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
Conversation
|
LGTM. Great finding. |
|
Yeah I forgot we might release 2.8.x. :) |
| public Map<String, String> build(Object data) { | ||
| final List<byte[]> flatHash = (List<byte[]>) data; | ||
| final Map<String, String> hash = new HashMap<String, String>(); | ||
| final Map<String, String> hash = new HashMap<String, String>(flatHash.size()/2); |
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.
You might want to add load factor 1 as you already know the target size in advance. Load factor 1 prevents rehashing. Same for the change below.
|
LGTM after addressing @mp911de comments. |
… resized when Redis Hash has too many keys.
|
Added load factor |
|
Amazing! Good catch! LGTM! |
… resized when Redis Hash has too many keys. (#1343)
|
Merged. Applied to 2.8 and 2.9 respectively. |
… resized when Redis Hash has too many keys. (#1343)
To avoid it being resized when Redis Hash has too many keys.