Richard said:
[...] seconds IIRC. The translation to .Net involved converting to
"managed" C++.
O.K. thank you for the information and please apologize the parts of my
posts which might have been unintentionally offensive.
To be honest I'm playing around with managed C++ only after the old
managed C++ style supported by VS7 had been deprecated and C++/CLI has
been introduced.
So I have only performance experience with the newer C++/CLI syntax and
don't know if the managed C++ syntax / implementation had some
"performance problems". It definitively had some readability problems,
regarding the ugly double underscore keywords, although these have been
more standard compliant.
60 times is a huge decrease and from the information I currently have I
would suspect it to be a string problem, since strings in .NET are
immutable and therefore each changing of a string creates a new string
object, which may be quite inefficient.
But it's also possible that managed C++ had other performance problems.
That a performance decrease is not always the case, when switching to
managed C++, here a little illustrative example I'm currently
investigating:
-------------------------------------------------
Native C++ example:
class T { public: void cb(int i) {} };
void perf()
{
test t;
boost::function<void (int)> foo = boost::bind<void>(&T::cb, t, _1);
foo(100); return 0;
}
-------------------------------------------------
Managed C++/CLI example:
ref class T { public: void cb(int i) {} };
delegate void CBD(int i);
void perf()
{
T^ test = gcnew T();
CBD^ foo = gcnew CBD(test, &T::callback);
foo(100);
return 0;
}
-------------------------------------------------
The native function call foo(100) needs 30 assembly instructions and 3
branches/jumps.
The managed one needs 5 assembly instructions and 3 branches/jumps.
But it's too early to derive anything from that. I'm currently searching
for the problem / failure I've made - if there is one.
And I'm not an expert regarding the boost::bind/function templates, so
maybe there's a more efficient way to write it, which reduces the number
of assembly instructions needed too.
[...] C5.0, 5.1 and 6.0 (which pre-dated Visual C++). I am perfectly well
aware of the difference between debug and release.
Then please apologize, wasn't my intention to be offensive. I've got
bitten by the default configuration too, activated all optimizations, but
forgot to remove/change the damn debug macros.
Andre