提交 5c7a90a1 编写于 作者: H hannesw

8015379: PropertyMap.addProperty() is slow

Reviewed-by: attila, jlaskey
上级 c186b650
......@@ -95,7 +95,6 @@ public final class PropertyMap implements Iterable<Object>, PropertyListener {
*/
private PropertyMap(final PropertyHashMap properties, final int fieldCount, final int fieldMaximum) {
this.properties = properties;
this.hashCode = computeHashCode();
this.fieldCount = fieldCount;
this.fieldMaximum = fieldMaximum;
......@@ -125,7 +124,6 @@ public final class PropertyMap implements Iterable<Object>, PropertyListener {
this.spillLength = propertyMap.spillLength;
this.fieldCount = propertyMap.fieldCount;
this.fieldMaximum = propertyMap.fieldMaximum;
this.hashCode = computeHashCode();
if (Context.DEBUG) {
count++;
......@@ -610,6 +608,9 @@ public final class PropertyMap implements Iterable<Object>, PropertyListener {
@Override
public int hashCode() {
if (hashCode == 0 && !properties.isEmpty()) {
hashCode = computeHashCode();
}
return hashCode;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册