Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/11517#discussion_r55010439 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/BenchmarkWholeStageCodegen.scala --- @@ -84,6 +84,31 @@ class BenchmarkWholeStageCodegen extends SparkFunSuite { */ } + ignore("range/sample") { + val N = 50 << 10 + runBenchmark("range/sample withRep.", N) { + sqlContext.range(N).sample(true, 0.8).collect() + } + /* + Westmere E56xx/L56xx/X56xx (Nehalem-C) + range/sample withRep.: Best/Avg Time(ms) Rate(M/s) Per Row(ns) Relative + ------------------------------------------------------------------------------------------- + range/sample withRep. codegen=false 149 / 238 0.3 2908.4 1.0X + range/sample withRep. codegen=true 192 / 206 0.3 3751.7 0.8X --- End diff -- The performance regression should be due to the current implementation of two samplers used in Sample operator. The samplers take iterator and return iterator. However, since we consume individual elements from parent operator in Sample, now this change needs to create another iterator from these elements. I will try to implement another version of the two samplers without iterator. It should improve the performance here.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org