-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-27009][TEST] Add Standard Deviation to benchmark results #23914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,16 +111,17 @@ private[spark] class Benchmark( | |
| // The results are going to be processor specific so it is useful to include that. | ||
| out.println(Benchmark.getJVMOSInfo()) | ||
| out.println(Benchmark.getProcessorName()) | ||
| out.printf("%-40s %16s %12s %13s %10s\n", name + ":", "Best/Avg Time(ms)", "Rate(M/s)", | ||
| "Per Row(ns)", "Relative") | ||
| out.println("-" * 96) | ||
| out.printf("%-40s %16s %12s %13s %10s %13s\n", name + ":", "Best/Avg Time(ms)", "Rate(M/s)", | ||
| "Per Row(ns)", "Relative", "Stdev (ms)") | ||
| out.println("-" * 110) | ||
| results.zip(benchmarks).foreach { case (result, benchmark) => | ||
| out.printf("%-40s %16s %12s %13s %10s\n", | ||
| out.printf("%-40s %16s %12s %13s %10s %13s\n", | ||
| benchmark.name, | ||
| "%5.0f / %4.0f" format (result.bestMs, result.avgMs), | ||
| "%10.1f" format result.bestRate, | ||
| "%6.1f" format (1000 / result.bestRate), | ||
| "%3.1fX" format (firstBest / result.bestMs)) | ||
| "%3.1fX" format (firstBest / result.bestMs), | ||
| "%5.0f" format result.stdevMs) | ||
| } | ||
| out.println | ||
| // scalastyle:on | ||
|
|
@@ -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) | ||
|
||
| Result(avg / 1000000.0, num / (best / 1000.0), best / 1000000.0, stdev / 1000000.0) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -191,7 +193,7 @@ private[spark] object Benchmark { | |
| } | ||
|
|
||
| case class Case(name: String, fn: Timer => Unit, numIters: Int) | ||
| case class Result(avgMs: Double, bestRate: Double, bestMs: Double) | ||
| case class Result(avgMs: Double, bestRate: Double, bestMs: Double, stdevMs: Double) | ||
|
|
||
| /** | ||
| * This should return a user helpful processor information. Getting at this depends on the OS. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, this adds the new value at the end. Can we move this to
Best/Avg Time(ms)group? For example,Best/Avg/Stdev Time(ms)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess
Best/Avg/Stdev (ms)will be enough because we usePer Row(ns)already.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dongjoon-hyun I thought about this. But then the readability of the numbers might be worse.
How about make each of them a single column? E.g.
Best Time(ms) Avg Time(ms) Stdev Time(ms)I don't have a strong preference here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to add it, it doesn't make sense to do it separately at the end. I think best, avg, and stdev should be their own columns now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it, @srowen .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I can separate it and place it after "avg" and before "rate"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok it looks like this now: