mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +00:00
(index) Experimental ranking signals
This commit is contained in:
parent
c6c8b059bf
commit
eba2844361
@ -1,5 +1,7 @@
|
|||||||
package nu.marginalia.bench;
|
package nu.marginalia.bench;
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
import nu.marginalia.sequence.GammaCodedSequence;
|
import nu.marginalia.sequence.GammaCodedSequence;
|
||||||
import nu.marginalia.sequence.VarintCodedSequence;
|
import nu.marginalia.sequence.VarintCodedSequence;
|
||||||
import org.openjdk.jmh.annotations.*;
|
import org.openjdk.jmh.annotations.*;
|
||||||
@ -12,27 +14,44 @@ public class SequenceBenchmarks {
|
|||||||
public static class SequenceState {
|
public static class SequenceState {
|
||||||
VarintCodedSequence vcs;
|
VarintCodedSequence vcs;
|
||||||
GammaCodedSequence gcs;
|
GammaCodedSequence gcs;
|
||||||
|
IntList list;
|
||||||
ByteBuffer workArea;
|
ByteBuffer workArea;
|
||||||
|
int[] arrayValues;
|
||||||
int[] valueBuffer;
|
int[] valueBuffer;
|
||||||
public SequenceState()
|
public SequenceState()
|
||||||
{
|
{
|
||||||
valueBuffer = new int[128];
|
valueBuffer = new int[128];
|
||||||
|
|
||||||
workArea = ByteBuffer.allocate(65536);
|
workArea = ByteBuffer.allocate(65536);
|
||||||
|
arrayValues = new int[] { 1, 3, 5, 16, 1024, 2048, 4096, 4098, 4100 };
|
||||||
|
list = new IntArrayList(arrayValues);
|
||||||
vcs = VarintCodedSequence.generate(1, 3, 5, 16, 1024, 2048);
|
vcs = VarintCodedSequence.generate(1, 3, 5, 16, 1024, 2048);
|
||||||
gcs = GammaCodedSequence.generate(workArea, 1, 3, 5, 16, 1024, 2048);
|
gcs = GammaCodedSequence.generate(workArea, 1, 3, 5, 16, 1024, 2048);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Fork(value = 5, warmups = 5)
|
||||||
|
// @Warmup(iterations = 5)
|
||||||
|
// @Benchmark
|
||||||
|
// @BenchmarkMode(Mode.Throughput)
|
||||||
|
// public int vcsDecode(SequenceState state) {
|
||||||
|
// var iter = state.vcs.iterator();
|
||||||
|
// int sum = 0;
|
||||||
|
// while (iter.hasNext()) {
|
||||||
|
// sum += iter.nextInt();
|
||||||
|
// }
|
||||||
|
// return sum;
|
||||||
|
// }
|
||||||
|
|
||||||
@Fork(value = 5, warmups = 5)
|
@Fork(value = 5, warmups = 5)
|
||||||
@Warmup(iterations = 5)
|
@Warmup(iterations = 5)
|
||||||
@Benchmark
|
@Benchmark
|
||||||
@BenchmarkMode(Mode.Throughput)
|
@BenchmarkMode(Mode.Throughput)
|
||||||
public int vcsDecode(SequenceState state) {
|
public int listDecode2(SequenceState state) {
|
||||||
var iter = state.vcs.iterator();
|
var list = state.arrayValues;
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
while (iter.hasNext()) {
|
for (int i = 0; i < list.length; i++) {
|
||||||
sum += iter.nextInt();
|
sum += list[i];
|
||||||
}
|
}
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user