Related articles |
---|
Compile time of C++ vs C# shirsoft@gmail.com (Shirsoft) (2009-09-01) |
Re: Compile time of C++ vs C# marcov@stack.nl (Marco van de Voort) (2009-09-02) |
Re: Compile time of C++ vs C# DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-09-02) |
Re: Compile time of C++ vs C# cr88192@hotmail.com (BGB / cr88192) (2009-09-02) |
Re: Compile time of C++ vs C# sh006d3592@blueyonder.co.uk (Stephen Horne) (2009-09-03) |
Re: Compile time of C++ vs C# cr88192@hotmail.com (BGB / cr88192) (2009-09-03) |
Re: Compile time of C++ vs C# lefevrol@yahoo.com (Olivier Lefevre) (2009-09-04) |
From: | Stephen Horne <sh006d3592@blueyonder.co.uk> |
Newsgroups: | comp.compilers |
Date: | Thu, 03 Sep 2009 04:44:29 +0100 |
Organization: | virginmedia.com |
References: | 09-09-009 |
Keywords: | performance |
Posted-Date: | 03 Sep 2009 00:32:45 EDT |
On Tue, 1 Sep 2009 13:15:35 -0700 (PDT), Shirsoft <shirsoft@gmail.com>
wrote:
>Hi,
>
>I am curious to know why C# code much faster than a similar sized C++
>code. How does MSIL help? Does having a common base class like object
>help in reducing compile times?
>
>Thanks,
>Shireesh
>[The optimizer is usually the slowest part of a compiler and I would guess that
>MSIL offers fewer opportunities than native code. -John]
Maybe, but I would have thought templates have a lot to answer for WRT
compile times in C++. C# has generics, but they probably use a
relatively simple model - the generic is compiled separately, but a
closure-like structure is used to fill in instance parameters. C++
templates are more like a kind of broken Haskell that gets interpreted
at compile-time to generate new code.
Obviously Haskell can be compiled, and templates could in principle be
compiled in much the way that many (most?) scripting languages are
compiled to a virtual machine model these days even when used
interactively. I dare say recent compilers do a lot to optimise
template handling. Still, I expect there's a fair amount of overhead
there just from using the standard library. And if you have a template
library that's prone to bloat, of course, you have a slow build
because of all the template instantiations that are being generated
and optimised.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.