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



I want to be able to stick with purely managed code, if possible. I just need
this 100 line function to run as fast as if it was hand tweaked assembly
language. I have examined CIL, for the most part it is essentially assembly
language. From what I understand any optimizations take place before the CIL is
generated. When I designed this system (in 1998) I had hand tweaked assembly
language in mind for this crucial function all along.

"Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:%23RjK3$oCGHA.2040@xxxxxxxxxxxxxxxxxxxxxxx
> Peter,
>
> Not at all. When the CLR gets a hold of the JIT, it is free to perform any
> optimizations it deems necessary, and that might not necessarily be in line
> with what you are expecting.
>
> My recommendation would be to use Managed C++ to create a wrapper to your
> unmanaged code which uses It Just Works (IJW, seriously). You should get a
> managed interface, and the best possible performance (for this specific
> situation, not all situations) between managed an unmanaged code.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> "Peter Olcott" <olcott@xxxxxxx> wrote in message
> news:_51sf.37898$QW2.37853@xxxxxxxxxxxxx
>>I need the best possible execution speed. I have found that there is a large
>>difference in the quality of the code generated by the various compilers. I
>>have 16,000 hours of development time in my current project. There is a 100
>>line function that must take no longer than 1/10 second to execute. I can just
>>barely achieve this with MSVC++ 6.0. MSVC++ 7.0 has had some of its
>>optimizations disabled. I eventually will need to port this to C# .NET. This
>>is a case where hand tweaked assembly language would be appropriate. I figured
>>that hand tweaked CIL would be the .NET equivalent of hand tweaked assembly
>>language.
>>
>> "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
>> message news:OCvd7unCGHA.2644@xxxxxxxxxxxxxxxxxxxxxxx
>>> Peter,
>>>
>>> You can write it, but you would have to create a module with IL, and then
>>> compile that into your assembly (or just write the whole assembly).
>>>
>>> Also, what optimizations do you think you can make? Ultimately, you
>>> suffer from the fact that Windows is not a real-time OS, and nothing you can
>>> do will change that. On top of that, the JIT is what's going to optimize
>>> your code again after you try to, so you might actually end up hurting
>>> yourself more than helping yourself.
>>>
>>> If you post the code you are trying to optimize, we can try and tell you
>>> where you might make some improvements, but dipping down to the IL level is
>>> most likely not going to help you much.
>>>
>>>
>>> --
>>> - Nicholas Paldino [.NET/C# MVP]
>>> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>>>
>>>
>>> "Peter Olcott" <olcott@xxxxxxx> wrote in message
>>> news:7t%rf.37887$QW2.9998@xxxxxxxxxxxxx
>>>> Cab you write code directly in the Common Intermediate language? I need to
>>>> optimize a critical real-time function.
>>>>
>>>
>>>
>>
>>
>
>


.



Relevant Pages

  • Re: WaitForSingleObject() will not deadlock
    ... represent an incorrect implementation of the language. ... the *compiler* does not guarantee this. ... but to state it in terms of the execution instead of the formal semantics of the language ... as long as the optimizations do not change the semantics of the language). ...
    (microsoft.public.vc.mfc)
  • Re: RAD vs. performance
    ... wrote in the dynamically typed language is wrong. ... to start executing compiler optimisations by hand. ... same optimizations. ...
    (comp.lang.misc)
  • Re: Why not Half Life 3 on Java ?
    ... religious fanatic about a language? ... We were talking about Java optimizations so I gave an example ... of something the JVMs are doing. ...
    (comp.games.development.programming.misc)
  • Re: RAD vs. performance
    ... typed language vs. your dynamically typed language, ... to start executing compiler optimisations by hand. ... same optimizations. ...
    (comp.lang.misc)
  • Re: Can you write code directly in CIL ???
    ... You don't understand a fundamental concept to .NET and CIL. ... are compilers that will perform optimization of IL to a certain degree. ... Just because it looks like assembly language, ... From what I understand any optimizations take place ...
    (microsoft.public.dotnet.languages.csharp)