File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
core/trino-spi/src/test/java/io/trino/spi/predicate Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,36 @@ private List<SortedRangeSet> benchmarkComplement(List<SortedRangeSet> dataRanges
169
169
return result ;
170
170
}
171
171
172
+ @ Benchmark
173
+ public List <Integer > getOrderedRangesSmall (Data data )
174
+ {
175
+ return benchmarkGetOrderedRanges (data .smallRanges );
176
+ }
177
+
178
+ @ Benchmark
179
+ public List <Integer > getOrderedRangesLarge (Data data )
180
+ {
181
+ return benchmarkGetOrderedRanges (data .largeRanges );
182
+ }
183
+
184
+ private List <Integer > benchmarkGetOrderedRanges (List <SortedRangeSet > dataRanges )
185
+ {
186
+ List <Integer > result = new ArrayList <>(dataRanges .size ());
187
+ for (int index = 0 ; index < dataRanges .size (); index ++) {
188
+ int hash = 0 ;
189
+ for (Range orderedRange : dataRanges .get (index ).getRanges ().getOrderedRanges ()) {
190
+ if (orderedRange .getLow ().getValueBlock ().isPresent ()) {
191
+ hash = hash * 31 + orderedRange .getLow ().getValue ().hashCode ();
192
+ }
193
+ if (orderedRange .getHigh ().getValueBlock ().isPresent ()) {
194
+ hash = hash * 31 + orderedRange .getHigh ().getValue ().hashCode ();
195
+ }
196
+ }
197
+ result .add (hash );
198
+ }
199
+ return result ;
200
+ }
201
+
172
202
@ State (Scope .Thread )
173
203
public static class Data
174
204
{
You can’t perform that action at this time.
0 commit comments