473,385 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

.NET versus C++ compiled code

Joe
Hi,

I am looking to start a brand new project. Yeahhh! ;-)

The code will do a lot of processor intensive processing. I mean a lot
of loops to archieve big calculations. You know recursive functions
and everything. Since I am a .NET programmer I have a question. Is
there a real big difference in term of performance (based on the
processors we have in our machine nowadays) between a .NET (C#)
program and the same one written in C++ compiled with Microsoft or
Borland C++ compiler.

I know that is a big question! Probably that too much factors can
influence the overall result.

Thanks.

Aug 27 '07 #1
9 1310
Joe wrote:
The code will do a lot of processor intensive processing. I mean a lot
of loops to archieve big calculations. You know recursive functions
and everything. Since I am a .NET programmer I have a question. Is
there a real big difference in term of performance (based on the
processors we have in our machine nowadays) between a .NET (C#)
program and the same one written in C++ compiled with Microsoft or
Borland C++ compiler.
Look up "Template Metaprogramming", starting with Boost.

In a nutshell, you trade very long compile times for very short execution
time. Declaring all your math in a template allows the compiler to squeeze
everything down to a solid brick of aggressively optimized opcodes.

--
Phlip
http://www.oreilly.com/catalog/9780596510657/
^ assert_xpath
http://tinyurl.com/23tlu5 <-- assert_raise_message
Aug 27 '07 #2
Joe
Okay.

Compiling to MSIL (.NET code produced by CLR) is very fast yes.
Declaring all your math in a template
What do you mean? I am a C++ dummy!

Aug 27 '07 #3
Joe wrote:
Compiling to MSIL (.NET code produced by CLR) is very fast yes.
>Declaring all your math in a template

What do you mean? I am a C++ dummy!
Look up template.

Then look up template metaprogramming.

It trades execution time for compile time. So you get a slow compile,
because the compiler is doing as much math as it can at compile time. Not
at runtime, where you don't want it

--
Phlip
http://www.oreilly.com/catalog/9780596510657/
^ assert_xpath
Aug 27 '07 #4
Joe
Okay. I found it about the subject: http://en.wikipedia.org/wiki/Template_metaprogramming

I love Wikipedia!

But since it's a C++ group maybe you are ignoring if C# support
template metaprogramming. Probably not.

Aug 27 '07 #5
On 2007-08-27 18:48, Joe wrote:
Okay. I found it about the subject: http://en.wikipedia.org/wiki/Template_metaprogramming

I love Wikipedia!

But since it's a C++ group maybe you are ignoring if C# support
template metaprogramming. Probably not.
C# have something called Generics which is not the same thing as C++
templates, it is not as powerful as templates and it's a run-time thing,
which means that you can't get the same performance boost as templates
can give you. If you are used to C# you've probably used generics
already, you usually encounter them when dealing with collections and
they can be identified by the usage of < and >, like so

List<int= new List<int>();

--
Erik Wikström
Aug 27 '07 #6
Joe
Yes Erik, I used them that way. So there is no way to use Generics the
way template works in C++?

Aug 27 '07 #7
Joe wrote:
Yes Erik, I used them that way. So there is no way to use Generics the
way template works in C++?
Please consider asking C# questions in a C# newsgroup.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 27 '07 #8
Joe
Victor, your right. Sorry.

Aug 27 '07 #9
Joe wrote:
Yes Erik, I used them that way. So there is no way to use Generics the
way template works in C++?
Templates in C++ have a very strict definition, almost like macros. They are
not the same as the systems in other languages that make classes into
objects, for example. This strict definition allows a compiler to squeeze
the code down very far.

Many languages need the other abilities of templates, so they get them using
a softer definition that doesn't permit these optimizations.

--
Phlip
http://www.oreilly.com/catalog/9780596510657/
Aug 27 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: DesignGuy | last post by:
I've read comparison of Perl vs. PHP regarding features and coding, however I would like to know how each affects server load. I am looking at two scripts - one in Perl and the other in PHP - for...
9
by: MStepansky | last post by:
Whats the difference between Javascript and Java3D? I mean can Javascript do like Java3D can? Or is Java3D on top of Javascript (the core, if thats what it is)? Then I should learn Javascript...
10
by: clueless_google | last post by:
hello. i've been beating my head against a wall over this for too long. setting the variables 'z' or 'y' to differing numbers, the following 'if/else' code snippet works fine; however, the ...
2
by: G.H.Lawrence | last post by:
Hello. I am relatively new to VS.NET and have ingerited a web application built by 2 previous developers. The most recent one compiled his C# source to a dll, the first one left her C# source as...
25
by: Siv | last post by:
Hi, As part of an evaluation of a small utility that I wrote that converts some data held in a large number of Excel spreadsheets into SQL Server, I decided to convert the utility to VB .NET and...
4
by: Rasta | last post by:
Hi, Can someone tell me the advantage of using asp.net over asp for development of ecommerce sites? Thanks
83
by: sunny | last post by:
Hi All What is C99 Standard is all about. is it portable, i mean i saw -std=C99 option in GCC but there is no such thing in VC++.? which one is better ANSI C / C99? can i know the major...
6
by: surfivor | last post by:
I may be involved in a data migration project involving databases and creating XML feeds. Our site is PHP based, so I imagine the team might suggest PHP, but I had a look at the PHP documentation...
5
by: Joe | last post by:
Hi, I am looking to start a brand new project. Yeahhh! ;-) The code will do a lot of processor intensive processing. I mean a lot of loops to archieve big calculations. You know recursive...
1
by: stupid48 | last post by:
Ok, I'm just a server guy with a bit a VS 2005 experience. I know that you can deploy asp.net apps either compiled or not compiled. My developer says that he prefers not to compile. I have to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.