Re: Can you write code directly in CIL ???



Nicholas Paldino [.NET/C# MVP] <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> I will second that the C++ compiler is better at optimizing IL output
> than the C# compiler. However, as Willy stated, it will not always produce
> verifiable code... I believe the article you were looking for is in MSDN
> magazine.

No, the article was definitely someone posting in this group saying, "I
want to be able to embed IL in my C# code, here's why." He then
produced some better IL (which I suspect *was* verifiable) which the C#
compiler "could" have produced from the source C# (i.e. the behaviour
was identical).

I'm sure this will improve over time, but to be honest it's usually the
JIT that has more to do with optimisation IMO.

> But as a general statement, the C++ compiler generally has the best
> optimizations (and for unmanaged code, with the new profile-guided
> optimization, it's even cooler).

Right.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: RAD vs. performance
    ... abstractions that will be there, whereas my compiler can optimize them ... Usually this doesn't matter, though. ... I'd say the same thing about your premature optimisation ...
    (comp.lang.misc)
  • Re: simple increment operator question.
    ... The Real OS/2 Guy wrote: ... > compiler to make optimasions right. ... > optimisation ability will produce better code for ... If find it sadly ironic that someone so concerned with the readability ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Coldfire MCF5475 performance question
    ... I find it is normally much easier to see what is happening at the assembly level with basic optimisation enabled. ... But too little optimisation can also make it difficult, since the compiler puts data on the stack and uses unnecessarily long, slow code sequences. ... I've since set the 3 bits in this register to turn each of the caches on, and the empty loop now takes 106us, a factor of 14 improvement. ... The easiest way to check your clock rate is if you have a decent scope, look at the clock output pin. ...
    (comp.arch.embedded)
  • Re: Debug optimised code
    ... DWARF2) and compiler optimizations. ... accurate results for higher optimization levels? ... optimisation levels mean very much. ... you have to start debugging optimised code. ...
    (comp.compilers)
  • Re: simple increment operator question.
    ... compiler to make optimasions right. ... optimisation ability will produce better code for ... I've never seen assember code for more than 15 years - ... language right when you have to write code in that language. ...
    (alt.comp.lang.learn.c-cpp)