Skip to content

Commit

Permalink
GH-2998 native store and LMDB store memory overflow performance (#4974)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmottestad authored Jun 5, 2024
2 parents c58eb52 + d30285a commit 1e08c3c
Show file tree
Hide file tree
Showing 30 changed files with 1,531 additions and 670 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,23 @@ public boolean equals(Object o) {
return false;
}

private int cachedHashCode = 0;

@Override
public int hashCode() {
return stringValue().hashCode();
int cached = cachedHashCode;
if (cached == 0) {
synchronized (this) {
cached = cachedHashCode;
if (cached == 0) {
cached = stringValue().hashCode();
cachedHashCode = cached;
}
}
cached = stringValue().hashCode();
cachedHashCode = cached;
}
return cached;
}

@Override
Expand Down
Loading

0 comments on commit 1e08c3c

Please sign in to comment.