ChrisHegarty opened a new pull request, #15062: URL: https://github.com/apache/lucene/pull/15062
This commit reworks the off-heap float32 bulk scoring to reduce garbage creation. The JVM fails to optimise things as we'd like, so we can just avoid some of the patterns in the first place! 1. Avoid slicing memory segments: our index input can span over up to 16GB by default, so we can just score a single segment (rather than slicing per scoring operation. 2. The hierarchy to allow scoring against an on-heap and off-heap query does not optimise well, so just flatten this and do the most obvious and straightforward thing - passing and switch on a null array or invalid address offset. Before ``` Benchmark (pollute) (size) Mode Cnt Score Error Units VectorScorerFloat32Benchmark.dotProductOptBulkScore false 1024 avgt 15 3.411 ± 0.262 ms/op VectorScorerFloat32Benchmark.dotProductOptBulkScore:gc.alloc.rate false 1024 avgt 15 3.935 ± 0.012 MB/sec VectorScorerFloat32Benchmark.dotProductOptBulkScore:gc.alloc.rate.norm false 1024 avgt 15 14120.816 ± 1070.540 B/op VectorScorerFloat32Benchmark.dotProductOptBulkScore:gc.count false 1024 avgt 15 ≈ 0 counts ``` After ``` Benchmark (size) Mode Cnt Score Error Units VectorScorerFloat32Benchmark.dotProductOptBulkScore 1024 avgt 15 3.557 ± 0.254 ms/op VectorScorerFloat32Benchmark.dotProductOptBulkScore:gc.alloc.rate 1024 avgt 15 240.211 ± 17.073 MB/sec VectorScorerFloat32Benchmark.dotProductOptBulkScore:gc.alloc.rate.norm 1024 avgt 15 894804.925 ± 1074.917 B/op VectorScorerFloat32Benchmark.dotProductOptBulkScore:gc.count 1024 avgt 15 4.000 counts VectorScorerFloat32Benchmark.dotProductOptBulkScore:gc.time 1024 avgt 15 24.000 ms ``` -- 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