DomGarguilo commented on PR #2811:
URL: https://github.com/apache/accumulo/pull/2811#issuecomment-1198615354
I have refactored `Key.equals()` in a way that makes it not show up in the
hot methods list any more. Here is the method after refactoring:
```java
public boolean equals(Key other, PartialKey part) {
boolean result = isEqual(row, other.row);
if (part == ROW)
return result;
result &= isEqual(colFamily, other.colFamily);
if (part == ROW_COLFAM)
return result;
result &= isEqual(colQualifier, other.colQualifier);
if (part == ROW_COLFAM_COLQUAL)
return result;
result &= isEqual(colVisibility, other.colVisibility);
if (part == ROW_COLFAM_COLQUAL_COLVIS)
return result;
result &= (timestamp == other.timestamp);
if (part == ROW_COLFAM_COLQUAL_COLVIS_TIME)
return result;
result &= (deleted == other.deleted);
if (part == ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL)
return result;
throw new IllegalArgumentException("Unrecognized partial key
specification " + part);
}
```
It will fall through and compare each `PartialKey` until it reaches `part`
and returns. Here is the current code to compare:
https://github.com/apache/accumulo/blob/388d3ffe11b3eaffe5a0022907d10e18bef73253/core/src/main/java/org/apache/accumulo/core/data/Key.java#L977-L1002
While this refactored method is smaller and no longer "hot", it should
probably be determined if this has any significant performance hits which is
what is being invstigated in #2812
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]