Re: C# and compiler optimizer.
- From: Helge Jensen <helge.jensen@xxxxxxx>
- Date: Thu, 14 Apr 2005 18:14:09 +0200
Olaf Baeyens wrote:
I am trying to understand the IL assembler created by C# but as far as I can see, there is no optimizing done by the C# compiler. Optimizing is done by the JIT, but it can only go so far.
<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>
In C++ you can put the 'inline' keyword for properties and methods that could be inserted into the generated code so you avoid a call and thus the overhead, but as far as I can see, C# does not seem to have this functionality.
Even in C++, "inline" is a linkage-specifier, not a specification of inling. The c++ compiler can choose to emit it as a separate function and call-instructions, but the function must have internal linkage.
You can easily verify this by compiling a recursive function:
inline int f(int x) { return f(x+1); }
int main(int argc, string** argv) { return f(0); }Compilers (and some JIT's) today have *very* advanced analysis of when inlining should be applied and when it should not.
Which specific performance problem do you have which can be solved by letting you specify inlining?
-- Helge Jensen mailto:helge.jensen@xxxxxxx sip:helge.jensen@xxxxxxx -=> Sebastian cover-music: http://ungdomshus.nu <=- .
- Follow-Ups:
- Re: C# and compiler optimizer.
- From: Olaf Baeyens
- Re: C# and compiler optimizer.
- References:
- C# and compiler optimizer.
- From: Olaf Baeyens
- C# and compiler optimizer.
- Prev by Date: Re: Add subnodes to an existing node
- Next by Date: Re: Why 2 different formats for directory?
- Previous by thread: Re: C# and compiler optimizer.
- Next by thread: Re: C# and compiler optimizer.
- Index(es):
Relevant Pages
|
Loading