Ichoran / thyme

Thyme is a microbenchmark utility for Scala. It includes Parsley, a (simple) local profiling tool.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't build on 2.11

retronym opened this issue · comments

Scala 2.10 contained a bug that failed to outlaw use of default arguments in more than one overloaded alternative when the alternatives involve type parameters.

Thyme exploits the compiler bug in the following overloads, and as such doesn't build under 2.11

  /** Order handling.  See `order` for details of parameters.  Returns a tuple containing a result from `f`; prints a benchmarking report. */
  def porder[A,B](resource: Int => Thyme.Resource[B])(f: Thyme.Resource[B] => A)(n0: Int, title: String = "", pr: String => Unit = Thyme.printer): A = {
    val bo = Thyme.Scaled.empty
    val ans = order(resource)(f)(bo,n0)
    bo.title = title
    pr(bo.toString)
    ans
  }

  /** Order handling.  Packs functions into `Resource` automatically. (Args for `f` are `start`, `n`, `data`.) Returns a tuple containing a result from `f`; prints a benchmarking report. */
  def porder[A,B](resource: Int => B)(f: (Int,Int,B) => A)(n0: Int, title: String = "", pr: String => Unit = Thyme.printer): A = {
    val bo = Thyme.Scaled.empty
    val ans = order(Thyme.Resource(resource))(Thyme.Resource.inline(f))(bo, n0)
    bo.title = title
    pr(bo.toString)
    ans
  }