Friday, March 21, 2014

How to profile methods in Scala?

http://stackoverflow.com/questions/9160001/how-to-profile-methods-in-scala

import System.{currentTimeMillis => _time}
def profile[R](code: => R, t: Long = _time) = (code, _time - t)

// usage:
val (result, time) = profile { /* block of code to be profiled*/ }

val (result2, time2) = profile methodToBeProfiled(foo)

No comments: