Skip to content

Commit

Permalink
Benchmark creation of 1-range ValueSet
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Oct 15, 2021
1 parent 1b447ee commit aec5384
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ public SortedRangeSet benchmarkBuilder(Data data)
return build;
}

@Benchmark
public List<SortedRangeSet> ofSingleRange(Data data)
{
List<SortedRangeSet> result = new ArrayList<>(data.ranges.size());
for (Range range : data.ranges) {
// intentionally going through public interface to cover any overhead or code path redirection this could incur
ValueSet valueSet = ValueSet.ofRanges(range);
result.add((SortedRangeSet) valueSet);
}
return result;
}

@Benchmark
public List<Boolean> equalsSmall(Data data)
{
Expand Down Expand Up @@ -250,6 +262,8 @@ public void test()

benchmarkBuilder(data);

ofSingleRange(data);

equalsSmall(data);
equalsLarge(data);

Expand Down

0 comments on commit aec5384

Please sign in to comment.