luyuncheng opened a new pull request, #12723: URL: https://github.com/apache/lucene/pull/12723
### Description I see some hot_thread like following stack, ``` java.lang.Thread.State: RUNNABLE at org.apache.lucene.store.DataInput.readVInt(DataInput.java:112) at org.apache.lucene.util.bkd.BKDReader$BKDPointTree.readDocIDs(BKDReader.java:636) at org.apache.lucene.util.bkd.BKDReader$BKDPointTree.visitDocValues(BKDReader.java:608) at org.apache.lucene.util.bkd.BKDReader$BKDPointTree.visitLeavesOneByOne(BKDReader.java:595) at org.apache.lucene.util.bkd.BKDReader$BKDPointTree.visitDocValues(BKDReader.java:589) at org.apache.lucene.index.PointValues.intersect(PointValues.java:364) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:357) at org.apache.lucene.index.PointValues.intersect(PointValues.java:337) at org.apache.lucene.document.SpatialQuery$RelationScorerSupplier.getSparseScorer(SpatialQuery.java:340) at org.apache.lucene.document.SpatialQuery$RelationScorerSupplier.getScorer(SpatialQuery.java:306) at org.apache.lucene.document.SpatialQuery$2.get(SpatialQuery.java:203) at org.apache.lucene.search.Weight.bulkScorer(Weight.java:175) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:724) ``` and when we call `BKDPointTree#visitDocValues#readDocIDs`->`DocIdWriter#readInts` https://github.com/apache/lucene/blob/c701a5d9be4d8dc677ea994f8ef5fdd8945760d6/lucene/core/src/java/org/apache/lucene/util/bkd/DocIdsWriter.java#L165-L174 it would do iteration to copy docids into `int[] docIDs` when type is `BITSET_IDS` or `CONTINUOUS_IDS`, and After this, it do iteration again to get docvalues in `visitDocValuesWithCardinality` ---- ### Proposal i think we can only do only one iteration like this pr shows. AND it can also reuse `visit(DocIdSetIterator iterator)` optimize when type is `DocBaseBitSetIterator` i do benchmark with luceneutil `IndexAndSearchShapes` tests, use params `-intersects -point -file osmdata.wkt` it shows: baseline: BEST QPS: 282.4637999101765 candidate: BEST QPS: 316.8185015110912 -- 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