DimensionRangeShardSpec speed boost. (#12477)
authorGian Merlino <gian@imply.io>
Wed, 27 Apr 2022 21:20:35 +0000 (14:20 -0700)
committerGitHub <noreply@github.com>
Wed, 27 Apr 2022 21:20:35 +0000 (14:20 -0700)
commit7b89682bbecc0feffb1996f90f6d8905458c054b
treee778b4e859d3d3500f267aef9788496efebe7991
parenta2bad0b3a2c80a5ffb704ec8c4a0e18734455d38
DimensionRangeShardSpec speed boost. (#12477)

* DimensionRangeShardSpec speed boost.

Calling isEmpty() and equals() on RangeSets is expensive, because these
fall back on default implementations that call size(). And size() is
_also_ a default implementation that iterates the entire collection.

* Fix and test from code review.
benchmarks/src/test/java/org/apache/druid/timeline/DimensionRangeShardSpecBenchmark.java [new file with mode: 0644]
core/src/main/java/org/apache/druid/timeline/partition/DimensionRangeShardSpec.java
core/src/test/java/org/apache/druid/timeline/partition/DimensionRangeShardSpecTest.java