pawel-bugalski-dynatrace commented on pull request #2429: URL: https://github.com/apache/lucene-solr/pull/2429#issuecomment-785282649
> The problem is this change doesn't just impact find() like the description states, but also other things like add() getting called by TermsHashPerField, a hot spot of indexer. I don't think we should rely on oracle's C2 EA to not create monster amounts of garbage, this is too important of a spot. In that case we can easily implement `equals` without allocation. ``` private boolean equals(int id, BytesRef b) { final int textStart = bytesStart[id]; final byte[] bytes = pool.buffers[textStart >> BYTE_BLOCK_SHIFT]; int pos = textStart & BYTE_BLOCK_MASK; final int length; final int offset; if ((bytes[pos] & 0x80) == 0) { // length is 1 byte length = bytes[pos]; offset = pos + 1; } else { // length is 2 bytes length = (bytes[pos] & 0x7f) + ((bytes[pos + 1] & 0xff) << 7); offset = pos + 2; } return Arrays.equals( bytes, offset, offset + length, b.bytes, b.offset, b.offset + b.length); } ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org