-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Simeon H.K. Fitch <fitch@astraea.io>
- Loading branch information
Showing
23 changed files
with
2,648 additions
and
149 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,9 +1,17 @@ | ||
enablePlugins(BenchmarkPlugin) | ||
|
||
libraryDependencies ++= Seq( | ||
spark("core"), | ||
spark("sql"), | ||
geotrellis("spark"), | ||
geotrellis("raster") | ||
) | ||
|
||
jmhIterations := Some(5) | ||
jmhTimeUnit := None | ||
javaOptions in Jmh := Seq("-Xmx4g") | ||
|
||
// To enable profiling: | ||
// jmhExtraOptions := Some("-prof jmh.extras.JFR") | ||
// jmhExtraOptions := Some("-prof gc") | ||
|
73 changes: 73 additions & 0 deletions
73
bench/src/main/scala/astraea/spark/rasterframes/bench/TileCellScanBench.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,73 @@ | ||
/* | ||
* This software is licensed under the Apache 2 license, quoted below. | ||
* | ||
* Copyright 2017 Astraea, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* [http://www.apache.org/licenses/LICENSE-2.0] | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
* | ||
*/ | ||
|
||
package astraea.spark.rasterframes.bench | ||
|
||
import java.util.concurrent.TimeUnit | ||
|
||
import geotrellis.raster.Tile | ||
import org.apache.spark.sql.catalyst.InternalRow | ||
import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder | ||
import org.apache.spark.sql.gt.InternalRowTile | ||
import org.apache.spark.sql.gt.types.TileUDT | ||
import org.openjdk.jmh.annotations._ | ||
|
||
@BenchmarkMode(Array(Mode.AverageTime)) | ||
@State(Scope.Benchmark) | ||
@OutputTimeUnit(TimeUnit.MICROSECONDS) | ||
/** | ||
* @author sfitch | ||
* @since 9/29/17 | ||
*/ | ||
class TileCellScanBench extends SparkEnv { | ||
|
||
@Param(Array("uint8", "int32", "float32", "float64")) | ||
var cellTypeName: String = _ | ||
|
||
@Param(Array("512")) | ||
var tileSize: Int = _ | ||
|
||
@transient | ||
var tileRow: InternalRow = _ | ||
|
||
@Setup(Level.Trial) | ||
def setupData(): Unit = { | ||
tileRow = TileUDT.serialize(randomTile(tileSize, tileSize, cellTypeName)) | ||
} | ||
|
||
@Benchmark | ||
def deserializeRead(): Double = { | ||
val tile = TileUDT.deserialize(tileRow) | ||
val (cols, rows) = tile.dimensions | ||
tile.getDouble(cols - 1, rows - 1) + | ||
tile.getDouble(cols/2, rows/2) + | ||
tile.getDouble(0, 0) | ||
} | ||
|
||
@Benchmark | ||
def internalRowRead(): Double = { | ||
val tile = new InternalRowTile(tileRow) | ||
val cols = tile.cols | ||
val rows = tile.rows | ||
tile.getDouble(cols - 1, rows - 1) + | ||
tile.getDouble(cols/2, rows/2) + | ||
tile.getDouble(0, 0) | ||
} | ||
} | ||
|
66 changes: 66 additions & 0 deletions
66
bench/src/main/scala/astraea/spark/rasterframes/bench/TileExplodeBench.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,66 @@ | ||
/* | ||
* This software is licensed under the Apache 2 license, quoted below. | ||
* | ||
* Copyright 2017 Astraea, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* [http://www.apache.org/licenses/LICENSE-2.0] | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
* | ||
*/ | ||
package astraea.spark.rasterframes.bench | ||
|
||
import java.util.concurrent.TimeUnit | ||
|
||
import astraea.spark.rasterframes._ | ||
import org.apache.spark.sql._ | ||
import org.apache.spark.sql.functions._ | ||
import org.openjdk.jmh.annotations._ | ||
|
||
/** | ||
* | ||
* @author sfitch | ||
* @since 10/4/17 | ||
*/ | ||
@BenchmarkMode(Array(Mode.AverageTime)) | ||
@State(Scope.Benchmark) | ||
@OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
class TileExplodeBench extends SparkEnv { | ||
import spark.implicits._ | ||
|
||
@Param(Array("uint8", "uint16ud255", "float32", "float64")) | ||
var cellTypeName: String = _ | ||
|
||
@Param(Array("256")) | ||
var tileSize: Int = _ | ||
|
||
@Param(Array("100")) | ||
var numTiles: Int = _ | ||
|
||
@transient | ||
var tiles: DataFrame = _ | ||
|
||
@Setup(Level.Trial) | ||
def setupData(): Unit = { | ||
tiles = Seq.fill(numTiles)(randomTile(tileSize, tileSize, cellTypeName)) | ||
.toDF("tile").repartition(10) | ||
} | ||
|
||
@Benchmark | ||
def arrayExplode() = { | ||
tiles.select(posexplode(tileToArray[Double]($"tile"))).count() | ||
} | ||
|
||
@Benchmark | ||
def tileExplode() = { | ||
tiles.select(explodeTiles($"tile")).count() | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.0.2 | ||
sbt.version=1.0.4 |
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
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
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
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
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
Oops, something went wrong.