Groovy Speed 3 - Groovin' with Groovy | [ Prev | Home | Next ] |
benchmark = { n, closure | start = System.currentTimeMillis() n.times { closure.call } delta = System.currentTimeMillis() - start ((float)delta) / n } def fact(n) { (2..n).inject(1) { f, i | f * i } } t = benchmark(1000) { fact(10) } println "Groovy: ${1000*t} MicroSeconds per call"
Groovy: 919.0 MicroSeconds per call
Copyright 2004 by Jim Weirich (Some Rights Reserved) |