I have used the basic
example taken from ScalaMeter's example repository (https://github.com/scalameter/scalameter-examples). The code of the example is as follows:
measure method "map" in {
using(ranges) in { r =>
r.map(_ + 1)
}
}
In my case I want to test the speedup of running some actions in parallel. A simple example could be, that I divide a range that has to be mapped. I used ExecutorService
from Java8
to run the tasks in parallel. It looks like this:
val cores = Runtime.getRuntime.availableProcessors()
val pool = Executors.newFixedThreadPool(cores)
measure method "parallel map" in {
using(ranges) in { r =>
val tasks = (0 until cores).map { t =>
new Callable[Unit] {
override def call() = (0 + t until r.last by cores).map(_ + 1)
}
}
import collection.JavaConverters._
pool.invokeAll(tasks.asJava)
}
}
The problem is that although the parallel test finishes (you can see the time results) it does not return the exit code. The implication is that if I change the Bench.LocalTime
to Bench.ForkedTime
even the results are gone. I am quite confused what is going on.
Any ideas?