Joe wrote:
[...]
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.
My experience has been that the overhead is much smaller than I would
have expected before I started doing .NET programming a few years ago.
Under normal conditions, where the code is not entirely CPU-bound, the
overhead is practically invisible, because the code is mostly waiting
for other things anyway.
If you have code that _is_ completely CPU-bound, you may be able to
measure a difference. If that code takes a long time to run, that
difference may translate to a genuinely noticeable delay. But it's
impossible to say in advance what sort of exact difference you might
notice without knowing the specifics of your algorithm.
Also in my experience, it has been true that if something needs speeding
up, usually the first place to start is fixing the algorithm, which is
almost never written optimally to start with. You might speed something
up by 10-25% (depending on a variety of factors) moving code to C++,
whereas fixing the algorithm can often speed things up by 50%, 100%, or
more. Algorithm problems are much more common than platform problems.
There are always exceptions, of course, but those will only be
identified by first making sure you have the most optimal algorithm, and
then doing an actual comparison between the C# and C++ versions of the
algorithm. It's impossible to say in advance what difference, if any,
there might be.
Pete