枪战(fannkuch) [英] Shootout (fannkuch)

查看:76
本文介绍了枪战(fannkuch)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

2008年4月30日星期三08:00:38 -0700(太平洋时间),Isaac Gouy

< ig **** @ yahoo.comwrote:

On Wed, 30 Apr 2008 08:00:38 -0700 (PDT), Isaac Gouy
<ig****@yahoo.comwrote:


>为什么不经历所有... ...
>Why don''t you go through all...



这次我将展示一个非常严重的问题

枪战网站。


C,C ++和D使用的算法比Java

版更好!有没有搞错?在某些情况下,Java版本是如此糟糕,以至于它的速度要慢10倍。


让我们重新开始吧。我们逐个查看列表。


你有这个版本的Java for fannkuch

http://shootout.alioth.debian.org/gp...lang = java& id = 2


我写了一个不同的版本(Heiner Marxen使用的算法)

http://pastebin.com/f41c2ef6f


当n = 11时>

0m10.165s -client(旧版)

0m6.064s -client(这个新版本)


4秒更快......


现在让它与C ++版本进行比较

http://shootout.alioth.debian.org/gp...&lang= gpp& id = 2


g ++ -pipe -O3 -fomit-frame-pointer fannkuch.cpp -o fannkuch.exe

jc -inline + fannkuch(java native compiler)

N 9 10 11

g ++ 0.115s 0.442 s 4.542s

java 0.206s 0.596s 5.970s(-client)

jet 0.310s 4.355s 4.355s


我使用-client,因为在这种情况下它比-server更快。喷射在

这个案例比g = g + g = n = 12.N = 12,差异是

更大1m1.187s v 0m56.697s

推荐答案

2008年5月5日星期一01:54:16 -0500,Razii< ty ****** @ hotmail.com>

写道:
On Mon, 05 May 2008 01:54:16 -0500, Razii <ty******@hotmail.com>
wrote:

> N 9 10 11
g ++ 0.115s 0.442s 4.542s
java 0.206s 0.596s 5.970 s(-client)
jet 0.310s 4.355s 4.355s
>N 9 10 11
g++ 0.115s 0.442s 4.542s
java 0.206s 0.596s 5.970s (-client)
jet 0.310s 4.355s 4.355s


> n = 12,差异甚至更大1m1.187s v 0m56.697s
>With n = 12, difference is even bigger 1m1.187s v 0m56.697s



为了使它也适用于gcj,我不得不做一些改动(使用print

而不是printf),所以新版本是这样的
http://pastebin.com/f630a1d8a


N 9 10 11 12

gcj 0.110s 0.398s 4.026s 54.037s(在Ubuntu上)


这比Jet快得多


我同时使用-fno-bounds-check AND -fno-store-check,这是你的意思

似乎从来没有。

To make it also work with gcj, I had to make slight changes (use print
instead of printf), so the new version is this
http://pastebin.com/f630a1d8a

N 9 10 11 12
gcj 0.110s 0.398s 4.026s 54.037s (on Ubuntu)

That''s even faster than Jet

I used both -fno-bounds-check AND -fno-store-check, something that you
never seem to do.


2008年5月5日星期一04:03:34 -0500,Razii< ty ****** @ hotmail .com>

写道:
On Mon, 05 May 2008 04:03:34 -0500, Razii <ty******@hotmail.com>
wrote:

>> N 9 10 11
g ++ 0.115s 0.442s 4.542s
java 0.206s 0.596s 5.970s(-client)
jet 0.310s 4.355s 4.355s
>>N 9 10 11
g++ 0.115s 0.442s 4.542s
java 0.206s 0.596s 5.970s (-client)
jet 0.310s 4.355s 4.355s



拼写错误:应该是0.591s,喷射n = 10

typo: that should have been 0.591s with n=10 for Jet


Razii< ty ****** @ hotmail.comwrites:
Razii <ty******@hotmail.comwrites:

2008年4月30日星期三08:00:38 -0700(太平洋时间),Isaac Gouy

< ig **** @ yahoo.comwrote:
On Wed, 30 Apr 2008 08:00:38 -0700 (PDT), Isaac Gouy
<ig****@yahoo.comwrote:

>>为什么不通过所有...
>>Why don''t you go through all...



这次我要演示一个

枪战网站的问题非常严重。


This time I am going to demonstrate a very serious problem with the
shootout site.



为什么你不去向一个该死的人展示它?这种语言福音(又名小便竞赛)的b $ b b只是婴儿。给它

a休息。


* plonk *


sherm--

-

我的博客: http:// shermspace。 blogspot.com

Perl中的Cocoa编程: http:// camelbones.sourceforge.net

Why don''t you go demonstrate it to someone who gives a damn? This kind
of language evangelism (aka pissing contest) is just infantile. Give it
a rest already.

*plonk*

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


这篇关于枪战(fannkuch)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆