Skip to content

Run benchmarks directly from sbt #2913

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

Merged
merged 6 commits into from
Jul 26, 2017
Merged

Conversation

nicolasstucki
Copy link
Contributor

To benchmark use

dotty-bench/jmh:run XYZ.scala

Setting up forks, warmups, ireations can be done in bench/src/main/scala/Benchmarks.scala

@nicolasstucki nicolasstucki requested a review from liufengyun July 25, 2017 14:31
@@ -828,7 +828,8 @@ object Build {
dependsOn(`dotty-compiler`).
settings(commonNonBootstrappedSettings).
settings(
mainClass in (Jmh, run) := Some("dotty.tools.benchmarks.Bench") // custom main for jmh:run
mainClass in (Jmh, run) := Some("dotty.tools.benchmarks.Bench"), // custom main for jmh:run
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please print the entire command line that was used to launch the behcnmark vm?

Copy link
Contributor Author

@nicolasstucki nicolasstucki Jul 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liufengyun do you know if that is possible without the jmh plugin?

Copy link
Contributor

@liufengyun liufengyun Jul 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the command runs, we'll have the output in the console, which shows the VM options:

# JMH 1.18 (released 134 days ago)
# VM version: JDK 1.8.0_131, VM 25.131-b11
# VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java
# VM options: -Xbootclasspath/a:some/jars
# Warmup: 10 iterations, 1 s each
# Measurement: 20 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: dotty.tools.benchmarks.Worker.compile

.timeUnit(TimeUnit.MILLISECONDS)
.forks(1)
.warmupIterations(12)
.measurementIterations(20)
.resultFormat(ResultFormatType.CSV)
.result("result.csv")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this file, and there'll be no result.csv, which is useless.

@@ -828,7 +828,8 @@ object Build {
dependsOn(`dotty-compiler`).
settings(commonNonBootstrappedSettings).
settings(
mainClass in (Jmh, run) := Some("dotty.tools.benchmarks.Bench") // custom main for jmh:run
mainClass in (Jmh, run) := Some("dotty.tools.benchmarks.Bench"), // custom main for jmh:run
javaOptions += "-DBENCH_CLASS_PATH=" + Attributed.data((fullClasspath in Compile).value).mkString("", ":", "")
).
enablePlugins(JmhPlugin).
settings(packSettings).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we don't use sbt-pack, it's fine to just remove the settings.

@DarkDimius
Copy link
Contributor

DarkDimius commented Jul 25, 2017 via email

@liufengyun
Copy link
Contributor

liufengyun commented Jul 25, 2017

We can add a script bin/bench, WDYT @DarkDimius ?

sbt "dotty-bench/jmh:run $@"

@nicolasstucki
Copy link
Contributor Author

@DarkDimius this is only intended as way quick to benchmark changes in the compiler itself. Hence sbt is the simplest option to make sure that everything is up to date with the latest changes in the compiler code. If we want reproducible benchmarks from command line we should use the benchmarks from https://github.com/liufengyun/bench instead.

@nicolasstucki
Copy link
Contributor Author

@liufengyun I added a couple of new commits.

@liufengyun
Copy link
Contributor

@nicolasstucki I thought I already merged this PR, well done :)

@liufengyun liufengyun merged commit 0ec7e56 into scala:master Jul 26, 2017
@allanrenucci allanrenucci deleted the bench-no-pack branch December 14, 2017 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants