All .NET Languages are no longer equal.

J

Jeff Louie

Imagine that. Up to now the party line was that the .NET languages
produced pretty much similar MSIL. With Visual Studio 2005, C++ is now
the most optimized. Ref. MSDN Magazine Jan 2005.

C++ optimizations now apply to managed code.
1) JIT and Compiler Optimization interaction
2) Common subexpression elimination and algebraic simplification.
3) Whole program optimization
4) 64 NGEN Optimization
5) Double thunk elimination
6) Interop optimization
7) Class instances with stack semantics

Now I just need to get my hands on a copy of Visual Studio 2005 <g>

Regards,
Jeff
 
J

Jon Skeet [C# MVP]

Jeff Louie said:
Imagine that. Up to now the party line was that the .NET languages
produced pretty much similar MSIL. With Visual Studio 2005, C++ is now
the most optimized. Ref. MSDN Magazine Jan 2005.

No, that's been the case before now as well. The C++ compiler has
always done much more optimisation than the C# and VB.NET compilers.
Just how useful that is depends on the exact code - the JIT is where
most of the really important optimisation is likely to occur, but
occasionally the C++ compiler can do much better than the C# compiler.

Usually when people talk about producing similar IL, they're talking
about C# vs VB.NET.
 
D

Daniel O'Connell [C# MVP]

Jeff Louie said:
Imagine that. Up to now the party line was that the .NET languages
produced pretty much similar MSIL. With Visual Studio 2005, C++ is now
the most optimized. Ref. MSDN Magazine Jan 2005.

C++ optimizations now apply to managed code.
1) JIT and Compiler Optimization interaction
2) Common subexpression elimination and algebraic simplification.
3) Whole program optimization
4) 64 NGEN Optimization
5) Double thunk elimination
6) Interop optimization
7) Class instances with stack semantics

Too bad that all requires C++. Wouldn't it be nice to have a nice optimizer
and a nice language at the same time?
 
J

Jeff Louie

Daniel... There is no question that C++ can be a difficult language, but
programmers familiar with the STL in C++ can now write managed code
using the STL.

Regards,
Jeff
Too bad that all requires C++. Wouldn't it be nice to have a nice
optimizer and a nice language at the same time?<
 
D

Daniel O'Connell [C# MVP]

Jeff Louie said:
Daniel... There is no question that C++ can be a difficult language, but
programmers familiar with the STL in C++ can now write managed code
using the STL.

I'm aware of that, and that doesn't sway me. It actually concerns me a bit.

I am curious how STL code will come out in the end. Will it be provide code
that is attractive to use in other languages, or is it basically a cute way
to turn managed C++ code into a mess that is horrible in other languages? I
can only hope they got it right, but due to the MI involved, I somehow doubt
it. If its the later, your topic fits much better as the run of the mill
managed C++ will probably be as alien as unmanaged C++ is, or at the least
direct Delphi compilations for the framework.

Unfortunatly, I don't think I have C++ installed, so I can't say for sure.
 
J

Jeff Louie

Dan...

As I recollect, Plauger was doing the STL port to .NET, but I cannot
find the column he wrote. I suspect that VS2005 will simply attract more
C++ coders to .NET, which is a good thing.

Regards,
Jeff
 
D

Daniel O'Connell [C# MVP]

Jeff Louie said:
Dan...

As I recollect, Plauger was doing the STL port to .NET, but I cannot
find the column he wrote. I suspect that VS2005 will simply attract more
C++ coders to .NET, which is a good thing.

More support is nice, yes. However, the concern still remains...is more
people writing what is effectivly alien code a good thing? I suppose
strictly from a numbers standpoint it is, but I am quite concerned that
there will be
C# & VB.NET libraries and C++ .NET libraires, introducing a nasty schism. I
dont want to have to learn the STL and its quirks to work with C++
libraries.

However, hopefully, the port will get things right and won't cause any undue
stress on anyones behalf.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

It may also be due that the C++ compiler should be more mature than those
of C# and VB.NET it has been around longer and had lots of optimizations for
a long time.


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
 
W

Willy Denoyette [MVP]

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

It may also be due that the C++ compiler should be more mature than those
of C# and VB.NET it has been around longer and had lots of optimizations
for a long time.

Some notes:
- the C++ front-end compiler (MSIL generator) has NOT been arround longer
than the other .NET compilers.
- the C++/CLI marketing team is well paid to promote 'their' product,
however, yet they fail to publish any benchmark ;-).

Willy.
 
D

Daniel O'Connell [C# MVP]

Jeff Louie said:
Imagine that. Up to now the party line was that the .NET languages
produced pretty much similar MSIL. With Visual Studio 2005, C++ is now
the most optimized. Ref. MSDN Magazine Jan 2005.

Ok, I finally got around to reading this article, so I have some comments:
C++ optimizations now apply to managed code.
1) JIT and Compiler Optimization interaction
2) Common subexpression elimination and algebraic simplification.

It would be nice if C# had these.
3) Whole program optimization

This, actually, is basically catchup with C#. The compilation model for C#
forces the compiler to analyze every file before generating any code. So the
few optimizations the C# compiler does that can occur over
multiple files were already performed(constants mainly).
4) 64 NGEN Optimization
From what the article said, the 64bit NGEN is considerably more complex than
the 64bit JIT...I wonder how well it does at generating code for non-C++
assemblies. It is slightly disenheartning that the JIT was designed to favor
C++, but with any luck it will boost all MSIL considerably.
5) Double thunk elimination
6) Interop optimization
Less important, IMHO, but its nice to have a langauge capable of performing
these calls with better performance when you have to deal with alot of
interop code.
7) Class instances with stack semantics

This would be a nice addition to C# as well, I just don't think its going to
happen anytime soon.

Not sure I would call it an optimization though, from what I've read it is
sorta like an automatic using statement.
 
R

Ravichandran J.V.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top