jpountz commented on code in PR #13636:
URL: https://github.com/apache/lucene/pull/13636#discussion_r1709378126


##########
lucene/core/src/java/org/apache/lucene/internal/vectorization/DefaultPostingDecodingUtil.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.internal.vectorization;
+
+import java.io.IOException;
+import org.apache.lucene.store.IndexInput;
+
+final class DefaultPostingDecodingUtil extends PostingDecodingUtil {
+
+  protected final IndexInput in;
+
+  public DefaultPostingDecodingUtil(IndexInput in) {
+    this.in = in;
+  }
+
+  @Override
+  public void splitLongs(int count, long[] b, int bShift, long bMask, long[] 
c, long cMask)
+      throws IOException {
+    assert count <= 64;
+    in.readLongs(c, 0, count);
+    // The below loop is auto-vectorized
+    for (int i = 0; i < count; ++i) {
+      b[i] = (c[i] >>> bShift) & bMask;
+      c[i] &= cMask;

Review Comment:
   And numbers when the vector module is enabled for reference:
   
   ```
   Benchmark                                      (bpv)   Mode  Cnt   Score   
Error   Units
   PostingIndexInputBenchmark.decode                  5  thrpt   15  40.887 ± 
0.565  ops/us
   PostingIndexInputBenchmark.decode                  6  thrpt   15  44.043 ± 
0.633  ops/us
   PostingIndexInputBenchmark.decode                  7  thrpt   15  42.804 ± 
0.813  ops/us
   PostingIndexInputBenchmark.decode                  8  thrpt   15  51.670 ± 
1.368  ops/us
   PostingIndexInputBenchmark.decode                  9  thrpt   15  36.076 ± 
0.177  ops/us
   PostingIndexInputBenchmark.decode                 10  thrpt   15  38.462 ± 
0.379  ops/us
   PostingIndexInputBenchmark.decodeAndPrefixSum      5  thrpt   15  19.973 ± 
0.230  ops/us
   PostingIndexInputBenchmark.decodeAndPrefixSum      6  thrpt   15  17.797 ± 
3.315  ops/us
   PostingIndexInputBenchmark.decodeAndPrefixSum      7  thrpt   15  20.274 ± 
0.664  ops/us
   PostingIndexInputBenchmark.decodeAndPrefixSum      8  thrpt   15  21.163 ± 
0.604  ops/us
   PostingIndexInputBenchmark.decodeAndPrefixSum      9  thrpt   15  18.460 ± 
0.493  ops/us
   PostingIndexInputBenchmark.decodeAndPrefixSum     10  thrpt   15  18.622 ± 
0.941  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

Reply via email to