@@ -70,7 +70,8 @@ public class VectorScorerBenchmark {
7070 IndexInput in ;
7171 KnnVectorValues vectorValues ;
7272 byte [] vec1 , vec2 ;
73- UpdateableRandomVectorScorer scorer ;
73+ UpdateableRandomVectorScorer scorer1 ;
74+ RandomVectorScorer scorer2 ;
7475
7576 @ Setup (Level .Iteration )
7677 public void init () throws IOException {
@@ -86,11 +87,11 @@ public void init() throws IOException {
8687 }
8788 in = dir .openInput ("vector.data" , IOContext .DEFAULT );
8889 vectorValues = vectorValues (size , 2 , in , DOT_PRODUCT );
89- scorer =
90- FlatVectorScorerUtil .getLucene99FlatVectorsScorer ()
91- .getRandomVectorScorerSupplier (DOT_PRODUCT , vectorValues )
92- . scorer ( );
93- scorer . setScoringOrdinal ( 0 );
90+
91+ FlatVectorsScorer flatVectorsScorer = FlatVectorScorerUtil .getLucene99FlatVectorsScorer ();
92+ scorer1 = flatVectorsScorer .getRandomVectorScorerSupplier (DOT_PRODUCT , vectorValues ). scorer ();
93+ scorer1 . setScoringOrdinal ( 0 );
94+ scorer2 = flatVectorsScorer . getRandomVectorScorer ( DOT_PRODUCT , vectorValues , vec1 );
9495 }
9596
9697 @ TearDown
@@ -99,14 +100,25 @@ public void teardown() throws IOException {
99100 }
100101
101102 @ Benchmark
102- public float binaryDotProductDefault () throws IOException {
103- return scorer .score (1 );
103+ public float binaryDotProductIndexingDefault () throws IOException {
104+ return scorer1 .score (1 );
105+ }
106+
107+ @ Benchmark
108+ @ Fork (jvmArgsPrepend = {"--add-modules=jdk.incubator.vector" })
109+ public float binaryDotProductIndexingMemSeg () throws IOException {
110+ return scorer1 .score (1 );
111+ }
112+
113+ @ Benchmark
114+ public float binaryDotProductSearchingDefault () throws IOException {
115+ return scorer2 .score (1 );
104116 }
105117
106118 @ Benchmark
107119 @ Fork (jvmArgsPrepend = {"--add-modules=jdk.incubator.vector" })
108- public float binaryDotProductMemSeg () throws IOException {
109- return scorer .score (1 );
120+ public float binaryDotProductSearchingMemSeg () throws IOException {
121+ return scorer2 .score (1 );
110122 }
111123
112124 static KnnVectorValues vectorValues (
0 commit comments