core: ConstStorage: Don't put known duplicate value to ValueStorage.values map
This is a microoptimization, which remove unnecessary values.put() and values.remove() pair of operations if ValueStorage.put() is called for a known duplicated value.
This commit is contained in:
@@ -38,16 +38,16 @@ public class ConstStorage {
|
||||
* @return true if this value is duplicated
|
||||
*/
|
||||
public boolean put(Object value, FieldNode fld) {
|
||||
if (duplicates.contains(value)) {
|
||||
values.remove(value);
|
||||
return true;
|
||||
}
|
||||
FieldNode prev = values.put(value, fld);
|
||||
if (prev != null) {
|
||||
values.remove(value);
|
||||
duplicates.add(value);
|
||||
return true;
|
||||
}
|
||||
if (duplicates.contains(value)) {
|
||||
values.remove(value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user