forked from locationtech/geotrellis
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to caliper benchmarks for geometry sequence ops
- Loading branch information
Showing
2 changed files
with
40 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
vector-benchmark/src/main/scala/geotrellis/vector/benchmark/GeometrySequenceOps.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package geotrellis.vector.benchmark | ||
|
||
import geotrellis.vector._ | ||
|
||
import geotrellis.vector.check.jts.Generators | ||
|
||
import org.scalacheck.{Test,Gen} | ||
|
||
object GeometrySequenceOps extends BenchmarkRunner(classOf[GeometrySequenceOps]) | ||
class GeometrySequenceOps extends FeatureBenchmark { | ||
|
||
var ml: MultiLine = null | ||
|
||
override def setUp() { | ||
val params = Test.Parameters.default | ||
val genPrms = new Gen.Parameters.Default { override val rng = params.rng } | ||
|
||
ml = null | ||
while (ml == null) { | ||
Generators.genMultiLineString(genPrms) match { | ||
case None => | ||
case Some(value) => | ||
ml = MultiLine(value) | ||
} | ||
} | ||
} | ||
|
||
def timeMultiLineUnion(reps: Int) = run(reps)(multiLineUnion) | ||
def multiLineUnion = ml.union | ||
|
||
def timeMultiLineIntersection(reps: Int) = run(reps)(multiLineIntersection) | ||
def multiLineIntersection = ml.intersection | ||
|
||
def timeMultiLineDifference(reps: Int) = run(reps)(multiLineDifference) | ||
def multiLineDifference = ml.difference | ||
|
||
def timeMultiLineSymDifference(reps: Int) = run(reps)(multiLineSymDifference) | ||
def multiLineSymDifference = ml.symDifference | ||
} | ||
|