Skip to content

Commit

Permalink
ForceInline the incrementKeyByCount method
Browse files Browse the repository at this point in the history
  • Loading branch information
alexklibisz committed Aug 29, 2024
1 parent 2624988 commit cbd3714
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ lazy val `elastiknn-lucene` = project
"org.apache.lucene" % "lucene-core" % LuceneVersion,
"org.apache.lucene" % "lucene-analysis-common" % LuceneVersion % Test
),
javacOptions ++= Seq(
"--add-exports",
"java.base/jdk.internal.vm.annotation=ALL-UNNAMED"
),
TestSettings
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.klibisz.elastiknn.search;

import jdk.internal.vm.annotation.ForceInline;
import org.apache.lucene.search.DocIdSetIterator;

import java.util.Arrays;
Expand Down Expand Up @@ -30,6 +31,7 @@ public ArrayHitCounter(int numDocs) {
this(numDocs, 10);
}

@ForceInline
private void incrementKeyByCount(int docId, short count) {
int newCount = (docIdToCount[docId] += count);
if (newCount > maxCount) maxCount = newCount;
Expand Down

0 comments on commit cbd3714

Please sign in to comment.