|
Scala Library
|
|
scala/testing/Benchmark.scala]
trait
Benchmark
extends AnyRef
Benchmark can be used to quickly turn an existing
class into a benchmark. Here is a short example:
object sort1 extends Sorter with Benchmark {
def run = sort(List.range(1, 1000))
}
The run method has to be defined by the user, who
will perform the timed operation there.
Run the benchmark as follows:
> scala sort1 5 times.log
This will run the benchmark 5 times and log the execution times in
a file called times.log
| Value Summary | |
var
|
multiplier : Int |
| Method Summary | |
def
|
main
(args : Array[java.lang.String]) : Unit
The entry point. It takes two arguments (n), (name)
and an optional argument multiplier (mult).
(n) is the number of consecutive runs, (name) the name
of a log file where to append the times.
if (mult) is present, the same thing is repeated (mult)
times.
|
def
|
prefix
: java.lang.String
a string that is written at the beginning of the output line
that contains the timings. By default, this is the class name.
|
abstract def
|
run
: Unit
this method should be implemented by the concrete benchmark
|
def
|
runBenchmark
(noTimes : Int) : List[Long]
Run the benchmark the specified number of times
and return a list with the execution times in milliseconds
in reverse order of the execution
|
| Methods inherited from AnyRef | |
| getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
| Methods inherited from Any | |
| ==, !=, isInstanceOf, asInstanceOf |
| Value Details |
| Method Details |
abstract
def
run : Unit
noTimes - ...
def
prefix : java.lang.String
def
main(args : Array[java.lang.String]) : Unit
|
Scala Library
|
|