[Benchmark] Make TermsAggregationSearchBenchmark fairer to uninverted field data.
The benchmark indexes 200 unique full-width longs. For uninverted field data we try to use the most memory-efficient storage, and in that case it would use two arrays: one for the doc->ordinals mapping and one for the ordinal->value mapping. Which is slower than what doc values do by storing directly the mapping from docs to values.
This commit is contained in:
parent
fdf2bb9371
commit
6f31b1135a
|
@ -175,10 +175,6 @@ public class TermsAggregationSearchBenchmark {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject())).actionGet();
|
.endObject())).actionGet();
|
||||||
|
|
||||||
long[] lValues = new long[NUMBER_OF_TERMS];
|
|
||||||
for (int i = 0; i < NUMBER_OF_TERMS; i++) {
|
|
||||||
lValues[i] = ThreadLocalRandom.current().nextLong();
|
|
||||||
}
|
|
||||||
ObjectOpenHashSet<String> uniqueTerms = ObjectOpenHashSet.newInstance();
|
ObjectOpenHashSet<String> uniqueTerms = ObjectOpenHashSet.newInstance();
|
||||||
for (int i = 0; i < NUMBER_OF_TERMS; i++) {
|
for (int i = 0; i < NUMBER_OF_TERMS; i++) {
|
||||||
boolean added;
|
boolean added;
|
||||||
|
@ -203,7 +199,7 @@ public class TermsAggregationSearchBenchmark {
|
||||||
XContentBuilder builder = jsonBuilder().startObject();
|
XContentBuilder builder = jsonBuilder().startObject();
|
||||||
builder.field("id", Integer.toString(counter));
|
builder.field("id", Integer.toString(counter));
|
||||||
final String sValue = sValues[ThreadLocalRandom.current().nextInt(sValues.length)];
|
final String sValue = sValues[ThreadLocalRandom.current().nextInt(sValues.length)];
|
||||||
final long lValue = lValues[ThreadLocalRandom.current().nextInt(lValues.length)];
|
final long lValue = ThreadLocalRandom.current().nextInt(NUMBER_OF_TERMS);
|
||||||
builder.field("s_value", sValue);
|
builder.field("s_value", sValue);
|
||||||
builder.field("l_value", lValue);
|
builder.field("l_value", lValue);
|
||||||
builder.field("s_value_dv", sValue);
|
builder.field("s_value_dv", sValue);
|
||||||
|
@ -220,7 +216,7 @@ public class TermsAggregationSearchBenchmark {
|
||||||
for (String field : new String[] {"lm_value", "lm_value_dv"}) {
|
for (String field : new String[] {"lm_value", "lm_value_dv"}) {
|
||||||
builder.startArray(field);
|
builder.startArray(field);
|
||||||
for (int k = 0; k < NUMBER_OF_MULTI_VALUE_TERMS; k++) {
|
for (int k = 0; k < NUMBER_OF_MULTI_VALUE_TERMS; k++) {
|
||||||
builder.value(lValues[ThreadLocalRandom.current().nextInt(sValues.length)]);
|
builder.value(ThreadLocalRandom.current().nextInt(NUMBER_OF_TERMS));
|
||||||
}
|
}
|
||||||
builder.endArray();
|
builder.endArray();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue