Do everything in Java…
Russel Winder via Digitalmars-d
digitalmars-d at puremagic.com
Mon Dec 8 00:33:16 PST 2014
On Sun, 2014-12-07 at 21:36 +0000, John Colvin via Digitalmars-d wrote:
> […]
> Got an example? I'd be interested to see a numerical-code example
> where the JVM can beat the llvm/gcc backends on a real
> calculation (even if it's a small one).
π by quadrature (it's just a single loop) can show the effect very
well, though currently anecdotally since I haven't set up proper
benchmarking even after 7 years of tinkering.
https://github.com/russel/Pi_Quadrature
Of course JVM suffers a JIT warm up which native code languages do not,
so you have to be careful with single data point comparisons.
As with any of these situation the convoluted hardcoded for a specific
processor code, especially assembly language will always win. I don't
care about that, I care about the fastest comprehensible code that is
portable simply by compilation or execution. Based on this, Java does
well, so does some Groovy perhaps surprisingly, also Scala. C++ does
well especially with TBB (though as an API it leaves a lot to be
desired). D is OK but only using ldc2 or gdc, dmd sucks. Go has issues
using gc but gccgo is fine. Rust does very well, but if using Cargo
for build you have to be careful to use --release. A big winner here
is Python, but only if you can get Numba working, Cython and Pythran
for me are a bit icky. On the outside rails is Chapel, which if it
could get some traction outside HPC would probably wipe the floor with
all other languages, with X10 a good runner up.
Of course this is just a trivial microbenchmark, you may be looking
for more real world actual codes.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
More information about the Digitalmars-d
mailing list