Skip to content

Commit cf2ed1c

Browse files
committed
Shorten
1 parent f9e0438 commit cf2ed1c

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/_nightly/esql/ValuesSourceReaderBenchmark.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@
8484
@State(Scope.Thread)
8585
@Fork(1)
8686
public class ValuesSourceReaderBenchmark {
87+
private static final String[] SUPPORTED_LAYOUTS = new String[] { "in_order", "shuffled", "shuffled_singles" };
88+
private static final String[] SUPPORTED_NAMES = new String[] {
89+
"long",
90+
"int",
91+
"double",
92+
"keyword",
93+
"stored_keyword",
94+
"3_stored_keywords" };
95+
8796
private static final int BLOCK_LENGTH = 16 * 1024;
8897
private static final int INDEX_SIZE = 10 * BLOCK_LENGTH;
8998
private static final int COMMIT_INTERVAL = 500;
@@ -102,8 +111,8 @@ static void selfTest() {
102111
ValuesSourceReaderBenchmark benchmark = new ValuesSourceReaderBenchmark();
103112
benchmark.setupIndex();
104113
try {
105-
for (String layout : ValuesSourceReaderBenchmark.class.getField("layout").getAnnotationsByType(Param.class)[0].value()) {
106-
for (String name : ValuesSourceReaderBenchmark.class.getField("name").getAnnotationsByType(Param.class)[0].value()) {
114+
for (String layout : ValuesSourceReaderBenchmark.SUPPORTED_LAYOUTS) {
115+
for (String name : ValuesSourceReaderBenchmark.SUPPORTED_NAMES) {
107116
benchmark.layout = layout;
108117
benchmark.name = name;
109118
try {
@@ -117,7 +126,7 @@ static void selfTest() {
117126
} finally {
118127
benchmark.teardownIndex();
119128
}
120-
} catch (IOException | NoSuchFieldException e) {
129+
} catch (IOException e) {
121130
throw new AssertionError(e);
122131
}
123132
}
@@ -319,10 +328,10 @@ public FieldNamesFieldMapper.FieldNamesFieldType fieldNames() {
319328
* each page has a single document rather than {@code BLOCK_SIZE} docs.</li>
320329
* </ul>
321330
*/
322-
@Param({ "in_order", "shuffled", "shuffled_singles" })
331+
@Param({ "in_order", "shuffled" })
323332
public String layout;
324333

325-
@Param({ "long", "int", "double", "keyword", "stored_keyword", "3_stored_keywords" })
334+
@Param({ "long", "keyword", "stored_keyword" })
326335
public String name;
327336

328337
private Directory directory;

0 commit comments

Comments
 (0)