Groovy1.1 beta-3 发布了!

Groovy1.1 beta-3 发布了!
Groovy1.1 beta-3终于发布了,出于好奇,我借用了emu同学的8皇后代码来测试一下Groovy1.1 beta-3和Groovy1.1 beta-2的性能差异,
利用Groovy1.1 beta-3和Groovy1.1 beta-2将8皇后代码各运行10次,记录下运行程序所耗时间,结果如下:


1 2 3 4 5 6 7 8 9 10       AVG
Groovy 1.1-beta2 1250 1250 1313 1203 1359 1219 1218 1297 1281 1344 1273.4
Groovy 1.1-beta3 1156 1078 1015 1047 1047 1156 1094 1031 1157 984 1076.5


经过计算,Groovy1.1 beta-3的性能提升了 15.5%,期待Groovy1.1 final :)

此外值得一提的是, IBM的ProjectZero团队正在为Groovy改善Eclipse插件, Sun也向Groovy Team施加援手提供服务器供其使用, JetBrains的IntelliJ IDEA Groovy & Grails插件milestone2版本已经发布。

测试所用的8皇后代码:
q = 8
i = new int[q]
count = 0

def scan(n){
    if (n == q){
        println(i.toList())
        count++
        return
    }
    i[n]=0
    while (i[n] < q){
        i[n] = i[n]+1
        if (check(n))
            scan(n + 1)
    }
}
def check(n){
    if (n > 0)
        for (j in 0..<n)
            if (i[j] == i[n] || i[j] - i[n] == j - n || i[j] - i[n] == n - j)
                return false
    return true
}

long t1 = System.currentTimeMillis()
scan(0)
long t2 = System.currentTimeMillis()
println("total time:" + ( t2 - t1))  // 耗时
println("total results:" + count)


下载地址:http://dist.groovy.codehaus.org/distributions/groovy-binary-1.1-beta-3.zip

附: 朝花夕拾——Groovy & Grails

你可能感兴趣的:(Groovy1.1 beta-3 发布了!)