You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/04/07 15:08:46 UTC

[GitHub] [lucene] rmuir commented on a change in pull request #69: LUCENE-9850: Use PFOR encoding for doc IDs (instead of FOR)

rmuir commented on a change in pull request #69:
URL: https://github.com/apache/lucene/pull/69#discussion_r608743773



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/PForUtil.java
##########
@@ -121,4 +167,146 @@ void skip(DataInput in) throws IOException {
       in.skipBytes(forUtil.numBytes(bitsPerValue) + (numExceptions << 1));
     }
   }
+
+  /**
+   * Fill {@code longs} with the final values for the case of all deltas being 1. Note this assumes
+   * there are no exceptions to apply.
+   */
+  private static void prefixSumOfOnes(long[] longs, long base) {
+    System.arraycopy(IDENTITY_PLUS_ONE, 0, longs, 0, ForUtil.BLOCK_SIZE);
+    // This loop gets auto-vectorized
+    for (int i = 0; i < ForUtil.BLOCK_SIZE; ++i) {
+      longs[i] += base;
+    }
+  }
+
+  /**
+   * Fill {@code longs} with the final values for the case of all deltas being {@code val}. Note
+   * this assumes there are no exceptions to apply.
+   */
+  private static void prefixSumOf(long[] longs, long base, long val) {
+    for (int i = 0; i < ForUtil.BLOCK_SIZE; i++) {
+      longs[i] = (i + 1) * val + base;

Review comment:
       @gsmiller here's what i do on linux:
   
   you need to build `hsdis-amd64.so` or similar (it is in openjdk sources and instructions to build from source can be found online, maybe even packages for your OS) and drop it into jvm's `lib/server` directory. This is a hook to binutils and allows for low level PrintAssembly option to give useful output.
   
   it may be easiest to write jmh microbenchmark targeting the code in question, and use jmh `perfasm`, that's what i do. it prevents mistakes by ensuring code is really "hot", and also targets only the interesting parts so you don't have to sort through tons of assembly. also on the side you get a benchmark for making tweaks and confirming them :)




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org