leverage the cached pdbwriters

this increased performance from 500 entries per second to 4000.
This commit is contained in:
2016-12-29 19:24:16 +01:00
parent de241ceb6d
commit f520f18e13
6 changed files with 66 additions and 27 deletions

View File

@@ -16,6 +16,8 @@ public class Tags {
private final Map<String, Tag> tags;
private int cachedHash = 0;
private Tags() {
super();
tags = Collections.emptyMap();
@@ -87,10 +89,17 @@ public class Tags {
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
return result;
if (cachedHash != 0) {
return cachedHash;
} else {
final int prime = 31;
int result = 1;
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
cachedHash = result;
return result;
}
}
@Override