blob: a0b388b89460599bd8a95655354acf579661f6f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package com.nsrddyn.tools
class Benchmark {
/*
* Calculate the time between the start of the execution of the function and the end
* */
def measureTime(work: => Unit): Long = {
val start = System.nanoTime()
work
val end = System.nanoTime()
end - start
}
// TODO: map this to an actual precision value
def measurePrecision(work: => Boolean, expectedResult: Boolean): Unit = if work == expectedResult then println(true) else println(false)
}
|