Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/10989#discussion_r51356558
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/execution/BenchmarkWholeStageCodegen.scala
---
@@ -81,6 +82,30 @@ class BenchmarkWholeStageCodegen extends SparkFunSuite {
benchmark.run()
}
+ def testBroadcastHashJoin(values: Int): Unit = {
+ val benchmark = new Benchmark("BroadcastHashJoin", values)
+
+ val dim = broadcast(sqlContext.range(1 << 16).selectExpr("id as k",
"cast(id as string) as v"))
+
+ benchmark.addCase("BroadcastHashJoin w/o codegen") { iter =>
+ sqlContext.setConf("spark.sql.codegen.wholeStage", "false")
+ sqlContext.range(values).join(dim, (col("id") % 60000) ===
col("k")).count()
+ }
+ benchmark.addCase(s"BroadcastHashJoin w codegen") { iter =>
+ sqlContext.setConf("spark.sql.codegen.wholeStage", "true")
+ sqlContext.range(values).join(dim, (col("id") % 60000) ===
col("k")).count()
+ }
+
+ /*
+ Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz
+ BroadcastHashJoin: Avg Time(ms) Avg Rate(M/s)
Relative Rate
+
-------------------------------------------------------------------------------
+ BroadcastHashJoin w/o codegen 3053.41 3.43
1.00 X
+ BroadcastHashJoin w codegen 1028.40 10.20
2.97 X
--- End diff --
can you also run a benchmark using a larger range so we amortize the
broadcast overhead? i'm interested in seeing what the improvement is for the
join part of the benchmark.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]