0

I wrote some code to test performance with diffrent JDK,here is the code

class GroovyWithJdk{
    static void run(){
        1000.times { "fib"(20) } //for dynamic
    }

    static def fib(n){
        if(n<2)
            return 1

        def c = {x,y->fib(x)+fib(y)} //test closure
        c(n-1,n-2)
    }
}



println System.getProperty("java.version")

long start = System.currentTimeMillis()
GroovyWithJdk.run()
println "${System.currentTimeMillis()-start}ms"

Here is the result:

1.6.0_45 6652ms

1.7.0_79 5590ms

1.8.0_20 4435ms

32bit JDK

1.8.0_51 12858ms

why 32 bit JDK's so slow?

varlxj
  • 11
  • 1

0 Answers0