msfroh commented on code in PR #12995: URL: https://github.com/apache/lucene/pull/12995#discussion_r1444066152
########## lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/TaxonomyIndexArrays.java: ########## @@ -38,27 +38,49 @@ * @lucene.experimental */ class TaxonomyIndexArrays extends ParallelTaxonomyArrays implements Accountable { + private static final int CHUNK_SIZE = 8192; - private final int[] parents; + private final ChunkedArray parents; // the following two arrays are lazily initialized. note that we only keep a // single boolean member as volatile, instead of declaring the arrays // volatile. the code guarantees that only after the boolean is set to true, // the arrays are returned. private volatile boolean initializedChildren = false; - private int[] children, siblings; + private ChunkedArray children, siblings; + + private static class ChunkedArray extends ParallelTaxonomyArrays.IntArray { + private final int[][] values; + + private ChunkedArray(int[][] values) { + this.values = values; + } + + @Override + public int get(int i) { + return values[i / CHUNK_SIZE][i % CHUNK_SIZE]; Review Comment: That's a great idea! -- 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: issues-unsubscr...@lucene.apache.org 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