Because of historical reasons, I have both C# and C++ managed/unmanaged code
mixed together in my class library.
But I prefer to port code to C# since it compiles faster and the syntax is
much more readable so I can do more in less time.
The big question now, will I gain/lose performance, given the fact that I
create pure managed code, if I port the managed C++ classes to C# classes? I
cannot port all the classes at once, too much to port, not enough time.
I use the C++ and C# standard edition 2003. For C++ no speed optimizing is
possible, but since C# uses the C# compiler from the .NET framework, I might
have faster speed this way? 29 1770
Hi,
Managed C++ and C# SHOULD theoretically compile to the same (or equivalent)
MSIL, so you should see no speed differences. In both cases, optimization is
performed by the JIT compiler at runtime. However, I'm not entirely sure as
to the relationship with VC++'s compiler optimization settings. Certainly
for unmanaged code they can make an enormous difference. They could have an
effect on managed code, but I don't know. If you're performing serious
number crunching in the unmanaged C++ you may find a performance hit if you
convert to C#. Having said that, coded well, performance problems should be
neglible. From my own experience, the difference between a debug build (no
optimization) and a release build (C++ compiler and linker optimization and
JIT optimization) there is a difference, but it tends to be noticeable in
the areas where there's processor intensive work going on (which is done by
a mixture of managed and unmanaged functions).
I suppose it depends on your app - is ease of development more valuable to
you than squeezing out performance? You'll never really know until you've
tried the C# ports, I guess. Maybe someone more knowledgeable than myself
can inform you (and me!) what effect the C++ compiler optimizations do in
combination with the JIT compiler.
Steve
"Olaf Baeyens" <ol**********@s kyscan.be> wrote in message
news:41******** **************@ news.skynet.be. .. Because of historical reasons, I have both C# and C++ managed/unmanaged
code mixed together in my class library. But I prefer to port code to C# since it compiles faster and the syntax
is much more readable so I can do more in less time.
The big question now, will I gain/lose performance, given the fact that I create pure managed code, if I port the managed C++ classes to C# classes?
I cannot port all the classes at once, too much to port, not enough time.
I use the C++ and C# standard edition 2003. For C++ no speed optimizing is possible, but since C# uses the C# compiler from the .NET framework, I
might have faster speed this way?
Steve McLellan wrote: Hi,
Managed C++ and C# SHOULD theoretically compile to the same (or equivalent) MSIL, so you should see no speed differences. In both cases, optimization is performed by the JIT compiler at runtime. However, I'm not entirely sure as to the relationship with VC++'s compiler optimization settings. Certainly for unmanaged code they can make an enormous difference. They could have an effect on managed code, but I don't know. If you're performing serious number crunching in the unmanaged C++ you may find a performance hit if you convert to C#. Having said that, coded well, performance problems should be neglible. From my own experience, the difference between a debug build (no optimization) and a release build (C++ compiler and linker optimization and JIT optimization) there is a difference, but it tends to be noticeable in the areas where there's processor intensive work going on (which is done by a mixture of managed and unmanaged functions).
I suppose it depends on your app - is ease of development more valuable to you than squeezing out performance? You'll never really know until you've tried the C# ports, I guess. Maybe someone more knowledgeable than myself can inform you (and me!) what effect the C++ compiler optimizations do in combination with the JIT compiler.
VC++ is and will even more in the future, produce more optimised code
than VC#.
Typically 25% faster code than C#. Upcoming optimisations available only
for C++ including PGO and OpenMP extensions etc support have serious
impact for critical applications.
Also provided C#/CLI deficiencies in comparison to the upcoming C++/CLI,
I cannot understand why one should move from C++ to C#.
Some references:
C++/CLI (vs C#/CLI) http://www23.brinkster.com/noicys/cppcli.htm http://microsoft.sitestream.com/Tech...V333_Sutte.ppt http://www.accu.org/conference/prese..._(keynote).pdf
VC++ oriented optimisations: http://msdn.microsoft.com/msdntv/epi...G/manifest.xml http://msdn.microsoft.com/visualc/de...timization.asp
--
Ioannis Vranos
"Ioannis Vranos" <iv*@guesswh.at .grad.com> wrote in message
news:O7******** ******@TK2MSFTN GP15.phx.gbl... Steve McLellan wrote: Hi,
VC++ is and will even more in the future, produce more optimised code than VC#.
Typically 25% faster code than C#. Upcoming optimisations available only for C++ including PGO and OpenMP extensions etc support have serious impact for critical applications.
Also provided C#/CLI deficiencies in comparison to the upcoming C++/CLI, I cannot understand why one should move from C++ to C#.
Hi,
I remember arguing about this before so I won't rehash it :-) That info's
good to know - it means that the tradeoff between C++ and C# (execution
speed rather than faster (or simpler) development) will probably still
remain. I didn't know that PGO was only for C++, that's interesting to note.
Thanks,
Steve
PGO is for native C++ only.
Managed C++/CLI producing 25% faster code than C#. Any resources that prove
this claim?
As far I see the differences are neglectable ,which is quite normal as both
generate almost the same IL that uses the same JIT backend.
Willy.
"Ioannis Vranos" <iv*@guesswh.at .grad.com> wrote in message
news:O7******** ******@TK2MSFTN GP15.phx.gbl... Steve McLellan wrote: Hi,
Managed C++ and C# SHOULD theoretically compile to the same (or equivalent) MSIL, so you should see no speed differences. In both cases, optimization is performed by the JIT compiler at runtime. However, I'm not entirely sure as to the relationship with VC++'s compiler optimization settings. Certainly for unmanaged code they can make an enormous difference. They could have an effect on managed code, but I don't know. If you're performing serious number crunching in the unmanaged C++ you may find a performance hit if you convert to C#. Having said that, coded well, performance problems should be neglible. From my own experience, the difference between a debug build (no optimization) and a release build (C++ compiler and linker optimization and JIT optimization) there is a difference, but it tends to be noticeable in the areas where there's processor intensive work going on (which is done by a mixture of managed and unmanaged functions).
I suppose it depends on your app - is ease of development more valuable to you than squeezing out performance? You'll never really know until you've tried the C# ports, I guess. Maybe someone more knowledgeable than myself can inform you (and me!) what effect the C++ compiler optimizations do in combination with the JIT compiler.
VC++ is and will even more in the future, produce more optimised code than VC#.
Typically 25% faster code than C#. Upcoming optimisations available only for C++ including PGO and OpenMP extensions etc support have serious impact for critical applications.
Also provided C#/CLI deficiencies in comparison to the upcoming C++/CLI, I cannot understand why one should move from C++ to C#. Some references:
C++/CLI (vs C#/CLI)
http://www23.brinkster.com/noicys/cppcli.htm http://microsoft.sitestream.com/Tech...V333_Sutte.ppt http://www.accu.org/conference/prese..._(keynote).pdf VC++ oriented optimisations:
http://msdn.microsoft.com/msdntv/epi...G/manifest.xml http://msdn.microsoft.com/visualc/de...timization.asp -- Ioannis Vranos
Steve McLellan wrote: Hi,
I remember arguing about this before so I won't rehash it :-) That info's good to know - it means that the tradeoff between C++ and C# (execution speed rather than faster (or simpler) development) will probably still remain. I didn't know that PGO was only for C++, that's interesting to note.
Faster development than what? Both have the exactly the same RAD and APIs.
--
Ioannis Vranos
I was refering to managed C++! VC++ is and will even more in the future, produce more optimised code than VC#.
This is what I don't know. Hard to predict the future.
Managed C++ and C# come close together in IL code.
Typically 25% faster code than C#.
My tests so far are closer to 10% between managed and unmanaged. But I think
it depends what you do.
I cannot understand why one should move from C++ to C#.
The biggest reason is compile time. which reduces dramatic
The second biggest is the syntax has been cleaned up, and is more intuitive,
so less likely to make errors, that you discover during compiling.
Third biggest reason is that no strange compiler and linker errors that
keeps you busy for days just to discover that an ";" has been misplaced.
For performance critical parts I still use unmanaged C++ so I am not running
away from C++, I just want to add the nice features of C# to speed up
development.
The biggest problem I always faced with C++ is these include paths,
cryptical compiler errors and the dreaded linker errors.
This is something I do not have in C#, so I am far more productive.
I am suprised that managed C++ would be faster than C# because C# does not
have to take unmanaged code into account within the same dll, and could
produce faster and compacter code.
I always assumed that there is some overhead in managed C++. Also the C#
compiler is provided with the .NET framework, so always optimized when you
upgrade to the newest .NET.
But this is my viewpoint.
I have started to port some small classes, but very intensively used to C#
and it seems not performance difference so far.
> Faster development than what? Both have the exactly the same RAD and APIs.
Compiles much faster. :-)
This compile time is what slows me down because of the huge number of lines
in my class library.
Willy Denoyette [MVP] wrote: Managed C++/CLI producing 25% faster code than C#. Any resources that prove this claim?
Mentioned in: http://microsoft.sitestream.com/Tech...V333_Sutte.ppt http://www.accu.org/conference/prese..._(keynote).pdf
and in various other places.
Also many articles mention that VC++ compiler produces compile-time
optimised code in addition to CLR runtime MSIL optimisation, and has
much more time to optimise the code than CLR.
Like this: http://msdn.microsoft.com/msdnmag/is...5/default.aspx
"While the just-in-time (JIT) compiler today analyzes for optimizations
at run time, allowing the C++ compiler to optimize during the initial
compilation can still provide significant performance benefits (the C++
compiler has much more time to perform its analysis than does the JIT)."
--
Ioannis Vranos
Olaf Baeyens wrote: My tests so far are closer to 10% between managed and unmanaged. But I think it depends what you do.
I am talking only about pure IL code.
And since on the subject let me give some examples of language strength:
Can you do this kind of thing in C# at *compile time*, producing 100%
verifiable code?
//A template function adding two objects
template <class T>
inline T Add(const T %a, const T %b)
{
return a+b;
}
value class someclass
{
int x;
};
int main()
{
int x = 7, y = 8;
int r = Add(x,y);
}
C:\c>cl /clr:safe temp.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.40809
for Microsoft (R) .NET Framework version 2.00.40607.16
Copyright (C) Microsoft Corporation. All rights reserved.
temp.cpp
Microsoft (R) Incremental Linker Version 8.00.40809
Copyright (C) Microsoft Corporation. All rights reserved.
/out:temp.exe
temp.obj
C:\c>
What about this:
ref class ReferenceType
{
int i;
public:
ReferenceType() :i(1) {}
ReferenceType(c onst ReferenceType %x) { i=x.i; }
void print() { System::Console ::WriteLine(i); }
};
template <class T>
void display(T x)
{
x.print();
}
int main()
{
// Object with stack semantics - Deterministic destruction
// at the end of its scope
ReferenceType obj;
display(obj);
// Object in the managed heap
ReferenceType ^hobj= gcnew ReferenceType;
display(*hobj);
// Deterministic destruction
delete hobj;
ReferenceType ^hobj2= gcnew ReferenceType;
display(*hobj2) ;
// Not destroying hobj2, let it be finalised
}
C:\c>cl /clr:safe temp.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.40809
for Microsoft (R) .NET Framework version 2.00.40607.16
Copyright (C) Microsoft Corporation. All rights reserved.
temp.cpp
Microsoft (R) Incremental Linker Version 8.00.40809
Copyright (C) Microsoft Corporation. All rights reserved.
/out:temp.exe
temp.obj
C:\c>temp
1
1
1
C:\c>
That is 100% verifiable code.
--
Ioannis Vranos This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andy Tran |
last post by:
I built a system using mysql innodb to archive SMS messages but the
innodb databases are not keeping up with the number of SMS messages
coming in. I'm looking for performance of 200 msgs/sec where 1 msg is
1 database row.
I'm running on Red Linux:
2.4.20-8bigmem #1 SMP Thu Mar 13 17:32:29 EST 2003 i686 i686 i386
GNU/Linux
The machine...
|
by: Ron Johnson |
last post by:
Hi,
While on the topic of "need for in-place upgrades", I got to think-
ing how the pg_restore could be speeded up.
Am I wrong in saying that in the current pg_restore, all of the
indexes are created in serial?
How about this new, multi-threaded way of doing the pg_restore:
0. On the command line, you specify how many threads you want.
|
by: murphy |
last post by:
I'm programming a site that displays info from AWS Commerce Service
4.0. At each change of the asp.net application the first load of a
page that uses the web service takes 30 seconds. Subsequent calls are
snappy. From what I've learned this overhead is for processing the
wsdl file (which has of course not changed). The file is large, 2200...
|
by: Brian Basquille |
last post by:
Hello all.
Have been working on the Air Hockey game on and off for a couple of weeks
now.. but have had plenty of other assignments to keep me busy along with
it.
But i would like some suggestions on improving it. It's far from fully
working, but some suggestions on the following would be great. Please
download it from:...
|
by: Robin |
last post by:
For an asp.net project that is deployed to a load balanced web servers, are
there any performance changes that can be made in .Net runtime or IIS 6?
Also are there any additional tips for reviewing the asp.net (VB) code for
improving performance?
| |
by: Larry Neylon |
last post by:
Hi,
I'm working on a VBScript application on IIS6 and I'm looking for some
advice about the best way of replacing or improving session variable usage.
The application is in a secure extranet environment. Currently the
application has a search customers page with 10 search fields which list the
results below the search fields. The...
|
by: mjheitland |
last post by:
Hello,
does anyone know if an update is available (or at least planned) for
the much cited standard reference
IMPROVING .NET APPLICATION PERFORMANCE AND SCALABILITY?
link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scalenet.asp
or as a download:
|
by: Rahul B |
last post by:
Hi,
We have been migrating to DB2 and it has been the trend that the
application has become somewhat slow.
It could be because of the application problems or it could be because
i am not very aware of how to try to improve the performance of the
DB2.
The only thing i am aware is about the RunStats utility.
Can somebody give me various...
|
by: Michel Esber |
last post by:
Hello,
Environment: DB2 LUW v8 FP15 / Linux
I have a table with 50+ Million rows. The table structure is basically
(ID - Timestamp). I have two main applications - one inserting rows,
and the other reading/deleting rows.
The 'deleter' application runs a MIN/MAX (timestamp) for each ID and,
if the difference between min/max is greater...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |