lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shanghaihyj <>
Subject Why Two Levels of Indirection in BytesRefHash class ?
Date Sun, 08 May 2016 12:44:14 GMT
I'm studying the BytesRefHash class, a mapping from bytes to a generated ID for the bytes.

In the BytesRefHash class, there are two levels of reference:
(1) ids[bytes' hash code] ---> count, where count is the self-incremental size of the this
(2) bytesStart[count] ---> offset in the ByteBlockPool, where the original bytes are stored.

My question is, can the above two references be collapsed into one, as follows ?
ids[bytes' hash code] ---> offset in the ByteBlockPool.

I've searched the code, and cannot grab an idea what's the benefit to have another indirection
via bytesStart.

p.s. Regarding such questions about Lucene source code, should I ask in
instead ? These questions may be too easy and thus bothering to the developers...
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message