gf2121 commented on code in PR #14910: URL: https://github.com/apache/lucene/pull/14910#discussion_r2215734792
########## lucene/core/src/java/org/apache/lucene/internal/vectorization/BitSetUtil.java: ########## @@ -30,11 +34,11 @@ class BitSetUtil { * stored in the provided {@code array}. * * <p>NOTE: Caller need to ensure the {@code array} has a length greater than or equal to {@code - * bitSet.cardinality(from, to) + 1}. + * bitSet.cardinality(from, to) + 16}. */ - static int denseBitsetToArray(FixedBitSet bitSet, int from, int to, int base, int[] array) { - assert bitSet.cardinality(from, to) + 1 <= array.length - : "Array length must be at least bitSet.cardinality(from, to) + 1"; + public final int bitsetToArray(FixedBitSet bitSet, int from, int to, int base, int[] array) { + assert bitSet.cardinality(from, to) + 16 <= array.length + : "Array length must be at least bitSet.cardinality(from, to) + 16"; Objects.checkFromToIndex(from, to, bitSet.length()); Review Comment: Here is the result ``` BitsetToArrayBenchmark.hybrid 256 thrpt 5 5.239 ± 0.202 ops/us BitsetToArrayBenchmark.hybrid 384 thrpt 5 6.077 ± 0.135 ops/us BitsetToArrayBenchmark.hybrid 512 thrpt 5 6.259 ± 0.087 ops/us BitsetToArrayBenchmark.hybrid 768 thrpt 5 5.926 ± 0.078 ops/us BitsetToArrayBenchmark.hybrid 1024 thrpt 5 4.889 ± 0.056 ops/us BitsetToArrayBenchmark.hybridUnrolling 256 thrpt 5 4.850 ± 0.054 ops/us BitsetToArrayBenchmark.hybridUnrolling 384 thrpt 5 5.940 ± 0.086 ops/us BitsetToArrayBenchmark.hybridUnrolling 512 thrpt 5 6.271 ± 0.098 ops/us BitsetToArrayBenchmark.hybridUnrolling 768 thrpt 5 5.328 ± 0.106 ops/us BitsetToArrayBenchmark.hybridUnrolling 1024 thrpt 5 4.174 ± 0.059 ops/us ``` In case you are interested, here is the full result of this new benchmark. ``` Benchmark (bitLength) Mode Cnt Score Error Units BitsetToArrayBenchmark.dense 256 thrpt 5 2.152 ± 0.017 ops/us BitsetToArrayBenchmark.dense 384 thrpt 5 1.308 ± 0.024 ops/us BitsetToArrayBenchmark.dense 512 thrpt 5 1.156 ± 0.020 ops/us BitsetToArrayBenchmark.dense 768 thrpt 5 0.991 ± 0.024 ops/us BitsetToArrayBenchmark.dense 1024 thrpt 5 0.888 ± 0.020 ops/us BitsetToArrayBenchmark.denseBranchLess 256 thrpt 5 5.646 ± 0.050 ops/us BitsetToArrayBenchmark.denseBranchLess 384 thrpt 5 3.999 ± 0.044 ops/us BitsetToArrayBenchmark.denseBranchLess 512 thrpt 5 3.097 ± 0.085 ops/us BitsetToArrayBenchmark.denseBranchLess 768 thrpt 5 2.099 ± 0.017 ops/us BitsetToArrayBenchmark.denseBranchLess 1024 thrpt 5 1.622 ± 0.020 ops/us BitsetToArrayBenchmark.denseBranchLessCmov 256 thrpt 5 3.692 ± 0.032 ops/us BitsetToArrayBenchmark.denseBranchLessCmov 384 thrpt 5 2.572 ± 0.033 ops/us BitsetToArrayBenchmark.denseBranchLessCmov 512 thrpt 5 1.970 ± 0.018 ops/us BitsetToArrayBenchmark.denseBranchLessCmov 768 thrpt 5 0.815 ± 0.015 ops/us BitsetToArrayBenchmark.denseBranchLessCmov 1024 thrpt 5 0.728 ± 0.008 ops/us BitsetToArrayBenchmark.denseBranchLessParallel 256 thrpt 5 5.803 ± 0.054 ops/us BitsetToArrayBenchmark.denseBranchLessParallel 384 thrpt 5 4.106 ± 0.056 ops/us BitsetToArrayBenchmark.denseBranchLessParallel 512 thrpt 5 3.202 ± 0.033 ops/us BitsetToArrayBenchmark.denseBranchLessParallel 768 thrpt 5 2.181 ± 0.018 ops/us BitsetToArrayBenchmark.denseBranchLessParallel 1024 thrpt 5 1.657 ± 0.019 ops/us BitsetToArrayBenchmark.denseBranchLessUnrolling 256 thrpt 5 6.157 ± 0.104 ops/us BitsetToArrayBenchmark.denseBranchLessUnrolling 384 thrpt 5 4.380 ± 0.042 ops/us BitsetToArrayBenchmark.denseBranchLessUnrolling 512 thrpt 5 3.392 ± 0.060 ops/us BitsetToArrayBenchmark.denseBranchLessUnrolling 768 thrpt 5 2.354 ± 0.023 ops/us BitsetToArrayBenchmark.denseBranchLessUnrolling 1024 thrpt 5 1.794 ± 0.012 ops/us BitsetToArrayBenchmark.denseInvert 256 thrpt 5 1.865 ± 0.034 ops/us BitsetToArrayBenchmark.denseInvert 384 thrpt 5 1.791 ± 0.025 ops/us BitsetToArrayBenchmark.denseInvert 512 thrpt 5 1.817 ± 0.018 ops/us BitsetToArrayBenchmark.denseInvert 768 thrpt 5 1.904 ± 0.015 ops/us BitsetToArrayBenchmark.denseInvert 1024 thrpt 5 1.816 ± 0.016 ops/us BitsetToArrayBenchmark.forLoop 256 thrpt 5 5.645 ± 0.081 ops/us BitsetToArrayBenchmark.forLoop 384 thrpt 5 6.118 ± 0.073 ops/us BitsetToArrayBenchmark.forLoop 512 thrpt 5 6.352 ± 0.068 ops/us BitsetToArrayBenchmark.forLoop 768 thrpt 5 5.957 ± 0.081 ops/us BitsetToArrayBenchmark.forLoop 1024 thrpt 5 4.931 ± 0.088 ops/us BitsetToArrayBenchmark.forLoopManualUnrolling 256 thrpt 5 5.411 ± 0.156 ops/us BitsetToArrayBenchmark.forLoopManualUnrolling 384 thrpt 5 5.699 ± 0.238 ops/us BitsetToArrayBenchmark.forLoopManualUnrolling 512 thrpt 5 5.585 ± 0.161 ops/us BitsetToArrayBenchmark.forLoopManualUnrolling 768 thrpt 5 4.667 ± 0.101 ops/us BitsetToArrayBenchmark.forLoopManualUnrolling 1024 thrpt 5 3.999 ± 0.037 ops/us BitsetToArrayBenchmark.hybrid 256 thrpt 5 5.239 ± 0.202 ops/us BitsetToArrayBenchmark.hybrid 384 thrpt 5 6.077 ± 0.135 ops/us BitsetToArrayBenchmark.hybrid 512 thrpt 5 6.259 ± 0.087 ops/us BitsetToArrayBenchmark.hybrid 768 thrpt 5 5.926 ± 0.078 ops/us BitsetToArrayBenchmark.hybrid 1024 thrpt 5 4.889 ± 0.056 ops/us BitsetToArrayBenchmark.hybridUnrolling 256 thrpt 5 4.850 ± 0.054 ops/us BitsetToArrayBenchmark.hybridUnrolling 384 thrpt 5 5.940 ± 0.086 ops/us BitsetToArrayBenchmark.hybridUnrolling 512 thrpt 5 6.271 ± 0.098 ops/us BitsetToArrayBenchmark.hybridUnrolling 768 thrpt 5 5.328 ± 0.106 ops/us BitsetToArrayBenchmark.hybridUnrolling 1024 thrpt 5 4.174 ± 0.059 ops/us BitsetToArrayBenchmark.whileLoop 256 thrpt 5 3.932 ± 0.021 ops/us BitsetToArrayBenchmark.whileLoop 384 thrpt 5 3.779 ± 0.054 ops/us BitsetToArrayBenchmark.whileLoop 512 thrpt 5 3.889 ± 0.049 ops/us BitsetToArrayBenchmark.whileLoop 768 thrpt 5 3.747 ± 0.083 ops/us BitsetToArrayBenchmark.whileLoop 1024 thrpt 5 3.856 ± 0.088 ops/us ``` -- 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