solutions5/bf.scala
changeset 231 eecbc9ae73c2
parent 230 bebe34c975a8
child 244 a359976a6f3e
equal deleted inserted replaced
230:bebe34c975a8 231:eecbc9ae73c2
   214 
   214 
   215 def time_needed[T](n: Int, code: => T) = {
   215 def time_needed[T](n: Int, code: => T) = {
   216   val start = System.nanoTime()
   216   val start = System.nanoTime()
   217   for (i <- 0 until n) code
   217   for (i <- 0 until n) code
   218   val end = System.nanoTime()
   218   val end = System.nanoTime()
   219   (end - start)/1.0e9
   219   (end - start)/(n * 1.0e9)
   220 }
   220 }
   221 
   221 
   222 time_needed(1, run(b1))
   222 time_needed(1, run(b1))
   223 */
   223 */
   224 
   224