First they ignore you
then they ridicule you
then they fight you
then you win
    -- Mahatma Gandhi
Chinese => English     英文 => 中文             
随笔-162  评论-871  文章-0  trackbacks-0
Groovy1.1 beta-3终于发布了,出于好奇,我借用了emu同学的8皇后代码来测试一下Groovy1.1 beta-3和Groovy1.1 beta-2的性能差异,
利用Groovy1.1 beta-3和Groovy1.1 beta-2将8皇后代码各运行10次,记录下运行程序所耗时间,结果如下:


12345678910      AVG
Groovy 1.1-beta212501250131312031359121912181297128113441273.4
Groovy 1.1-beta31156107810151047104711561094103111579841076.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
posted on 2007-09-21 20:33 山风小子 阅读(907) 评论(2)  编辑  收藏 所属分类: Groovy & Grails

评论:
# re: Groovy1.1 beta-3 发布了! 2007-09-21 20:37 | 千里冰封
现在脚 本语言真是多啊  回复  更多评论
  
# re: Groovy1.1 beta-3 发布了! 2007-09-21 20:40 | 山风小子
@千里冰封
Groovy是基于Java的老牌动态语言,而非‘脚本’语言,因为它的执行方式不是解释执行的 :)  回复  更多评论
  

标题  
姓名  
主页
验证码 *  
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2007-09-21 20:59 编辑过
 
成果网帮您增加网站收入
 
相关链接:
网站导航: