In article , Pancho wrote:
>> I'd say that from what I'm doing the Mono CIL on AMD64 is
>> between 1.5x and 8x slower. For computational intensive stuff
>> probably about 4x. Half that on the Windows CLR.
>
> That surprises me, my memory from circa 2003 was that C# numerical
> stuff ran at about the same speed as C++, my memory is poor to
> exact details, I would have probably have categorized 80% as the
> same speed. I would have probably tested using some type of
> numerical integration routine.
It's really hard to concoct a fair test. JIT-compiled code will always
suffer a small speed penalty for the time it takes to do the JIT
compilation, but may be faster than compiled C code thereafter because
the JIT compiler is able to make some whole-program optimizations and
is able to target the actual processor in use rather than generating
generic x86 or AMD64 (or whatever) code.
The longer a piece of JIT-compiled code is run, the less significant
the cost of compilation becomes.
Native code compilation systems are getting smarter -- It is possible
to perform some whole-program optimization at the link stage, for
example. The best we can say is that JITted code will always have some
penalty for the JIT stage, but may also gain some advantage from being
able to perform more specific optimizations. I think you would have to
be running something very time-critical for the difference to matter.
> I do remember there was a performance penalty gotcha from
> switching between managed and unmanaged code.
That will always be the case, as long as there needs to be a switch
between the managed and unmanaged runtime environments.
--
Cheers,
Daniel.
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|