Skip to content

Conversation

@harshmoorjani
Copy link
Contributor

To avoid it being resized when Redis Hash has too many keys.

@HeartSaVioR
Copy link
Contributor

LGTM. Great finding.

@HeartSaVioR
Copy link
Contributor

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);
Copy link
Contributor

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.

@marcosnils
Copy link
Contributor

LGTM after addressing @mp911de comments.

@harshmoorjani
Copy link
Contributor Author

Added load factor 1 as suggested by @mp911de

@xetorthio
Copy link
Contributor

Amazing! Good catch! LGTM!

@marcosnils marcosnils merged commit b145a83 into redis:master Jul 14, 2016
marcosnils pushed a commit that referenced this pull request Jul 14, 2016
@marcosnils
Copy link
Contributor

Merged. Applied to 2.8 and 2.9 respectively.

marcosnils pushed a commit that referenced this pull request Jul 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants