Re: C# and compiler optimizer.



Olaf Baeyens wrote:

Which specific performance problem do you have which can be solved by
letting you specify inlining?

Doing vector calculation, a few millions of them in one pass. :-)

Aaah, you're actully doing something -- not just reacting to GUI ;)

Try to do some timings on it, it may be as fast as native, or it may not...

If it is slow, you could try to factor that part of the code out, so you can reimplement it natively when performance starts rearing it's ugly head.

Those vectors have public properties X, Y and Z that (looking at IL asm)
appears not to be inline even though they are just stupid float without any
additional coding.

Why are you using properties? are you implementing/inheriting an interface/class?


The exported code has to have the public properties, for other code to be able to acces them, they are public :)

The JIT might inline the access while running, if it's called a lot.

the creation of the code and discover that is slows down too much. Then I am
going to look at the generated x86 code to see what the JIT did do.

Generally, doing a test with timings is a very informative and cheap way to evaluate performance.


<theory>
A JIT can just start by running the optimizations a traditional compiler
would do. Offline compilers can never be more "optimizing" than JIT.
</theory>

Yes assuming they have tons of time to analyze your program running and

notice the "<theory/>" ;)

optimize most used functions even further dynamically.

Compilers (and some JIT's) today have *very* advanced analysis of when
inlining should be applied and when it should not.

One of the things I am wondering is does you get a performance loss if you
use a class in one assembly that is defined in another assembly?

Try to make some timings, it won't take long :) I wouldn't expect any difference.


The assemblies are dll's, and I do know that dll's creates overhead in the
transition from one executable into your dll function.

But this is JIT, and the resolution of the just-address-resolution *could* be done just once, when the code is jit-compiled and inserted literally into the compiled version of the code. Try and time it.


--
Helge Jensen
  mailto:helge.jensen@xxxxxxx
  sip:helge.jensen@xxxxxxx
               -=> Sebastian cover-music: http://ungdomshus.nu <=-
.



Relevant Pages

  • Re: optimized code
    ... > loop invariants are handled by the JIT not by the compiler fron-ends. ... generates the best optimized MSIL of any of the .NET languages. ... standard native code optimizations on MSIL code. ...
    (microsoft.public.dotnet.languages.csharp)
  • misc: lang effort, performance
    ... I added a define that allowed me to enable/disable ref counting to see what ... a c implementation of the algo takes about 110ms (generic compiler options). ... I had started to consider the possibility of jit compilation. ... of course, thinking of it, some optimizations (those which I had originally ...
    (comp.lang.misc)
  • Re: optimized code
    ... All depends on what exactly you are measuring, how you are comparing and ... produced by the C++ compiler, when enabling max. optimizations (enables the ... > "Floating Point?The v1 JIT does not currently perform all the FP-specific ... > optimizations that the VC++ backend does, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: optimized code
    ... the Managed C++ compiler should still be better. ... > are left to the JIT. ... I assume the JIT is limited to peephole optimizations? ... If I have an inner loop of something like: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C# and compiler optimizer.
    ... Optimizing is done by the JIT, but it can only go so far. ... A JIT can just start by running the optimizations a traditional compiler would do. ... Which specific performance problem do you have which can be solved by letting you specify inlining? ...
    (microsoft.public.dotnet.languages.csharp)

Quantcast