All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eharmony.aloha.util.Timing.scala Maven / Gradle / Ivy

The newest version!
package com.eharmony.aloha.util

trait Timing {

    /** A standard timing function.
      * @param timeThis something to time
      * @tparam A the output type of the thing being timed.
      * @return
      */
    protected[this] final def time[A](timeThis: => A): (A, Float) = {
        val t1 = System.nanoTime
        val r = timeThis
        val t2 = System.nanoTime
        (r, (1.0e-9*(t2 - t1)).toFloat)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy