Created
July 6, 2016 01:23
-
-
Save mathhun/20f3697e7241e8b8daf8337a3cbaf4b3 to your computer and use it in GitHub Desktop.
Benchmark Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.scalameter._ | |
import scala.concurrent._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration._ | |
object Main extends App { | |
val standardConfig = config( | |
Key.exec.minWarmupRuns -> 20, | |
Key.exec.maxWarmupRuns -> 40, | |
Key.exec.benchRuns -> 10, | |
Key.verbose -> true | |
) withWarmer(new Warmer.Default) | |
val time0 = standardConfig measure { | |
val x = Future(()) | |
val xx = Await.result(x, Duration.Inf) | |
} | |
println(s"time0: $time0 ms") | |
val time1 = standardConfig measure { | |
val y = Future.successful(()) | |
val yy = Await.result(y, Duration.Inf) | |
} | |
println(s"time1: $time1 ms") | |
println(s"speedup: ${time0 / time1}") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment