搜索
bottom↓
回复: 4

今天在2410上 弄了个phoneme,java居然跑得比c++还快!

[复制链接]

出0入0汤圆

发表于 2010-9-28 14:47:57 | 显示全部楼层 |阅读模式
今天在2410上 弄了个phoneme,带JIT,跑了跑debian performance game里的binarytrees例子,java运行速度居然比c++还快!算上所有的加载虚机的时间还是快于c++,除掉加载时间的话,速度接近c++两倍!!!

测试代码从debian上下载的, http://shootout.alioth.debian.org/

真正大吃了一斤,不,一斤半!!!


java输出信息

$ time ./cvm -cp ../democlasses.jar cdc.binarytrees 12
stretch tree of depth 13         check: -1
8192     trees of depth 4        check: -8192
2048     trees of depth 6        check: -2048
512      trees of depth 8        check: -512
128      trees of depth 10       check: -128
32       trees of depth 12       check: -32
long lived tree of depth 12      check: -1
program running time 3542 ms
real    0m 3.80s
user    0m 3.37s
sys     0m 0.24s


c++输出信息


[]$ time ../../binarytree_cpp 12
stretch tree of depth 13         check: -1
8192     trees of depth 4        check: -8192
2048     trees of depth 6        check: -2048
512      trees of depth 8        check: -512
128      trees of depth 10       check: -128
32       trees of depth 12       check: -32
long lived tree of depth 12      check: -1
real    0m 6.27s
user    0m 6.06s
sys     0m 0.05s

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

发表于 2010-9-29 01:24:22 | 显示全部楼层
快这么多,不太可能啊……

C++版是什么优化等级编译的?
gprof下,看看C++版卡在那里了?

出0入0汤圆

发表于 2010-9-29 05:41:34 | 显示全部楼层
真的?

出0入0汤圆

发表于 2010-9-29 07:04:14 | 显示全部楼层
什么东西?

出0入0汤圆

 楼主| 发表于 2010-9-29 09:54:38 | 显示全部楼层
今天有重新编译了一下c++程序,带O2优化的,结果出来了。

$ time ./binarytrees-o2 12
stretch tree of depth 13         check: -1
8192     trees of depth 4        check: -8192
2048     trees of depth 6        check: -2048
512      trees of depth 8        check: -512
128      trees of depth 10       check: -128
32       trees of depth 12       check: -32
long lived tree of depth 12      check: -1
real    0m 1.10s
user    0m 0.95s
sys     0m 0.09s

-O3也做了一下,速度差别和-O2不大,大概0.97到1秒左右。

老大就是老大呀,嘿嘿嘿嘿......
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-14 00:34

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表