srowen commented on a change in pull request #23914: [SPARK-27009][TEST] Add
Standard Deviation to benchmark results
URL: https://github.com/apache/spark/pull/23914#discussion_r261380291
##########
File path: core/src/test/scala/org/apache/spark/benchmark/Benchmark.scala
##########
@@ -158,7 +159,8 @@ private[spark] class Benchmark(
// scalastyle:on
val best = runTimes.min
val avg = runTimes.sum / runTimes.size
- Result(avg / 1000000.0, num / (best / 1000.0), best / 1000000.0)
+ val stdev = math.sqrt(runTimes.map(time => math.pow(time - avg, 2)).sum /
runTimes.size)
Review comment:
You can assume (or assert) that there was at least 1 benchmarking run, or
none of the metrics mean anything. (maybe it's already asserted)
While the sample stdev is not really defined for 1 run, "0" is fine.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]