在 Mon, 23 Mar 2009 16:59:47 +0800,bearophile <[email protected]>
写道:
Part of the timings, seconds:
N = 4_000_000:
C: 0.36
Java: 5.59
C++: 9.97
Psyco: 29.28
Python: 32.68
D: 48.76 SLOW=false
D: 88.45 SLOW=true
You can find it here, with C/D/Java/C++/Python code too:
http://leonardo-m.livejournal.com/78890.html
I'd like to see timing comparisons on Linux between a Java reference and
LDC.
And I'd also like to know why using printf changes the situation so much.
Bye,
bearophile
Your C, C++ code won't catch exceptions:
try
{
char*p;
*p=0;
}
catch
{
}
The mechanism of exception system is different. So the performance differs.
In MSVC, you have __try / try , they are different things. The split of
exception is quite uncomfortable.
Though, it's quite fair tradeoff. You can't work out a better solution.