Peter Olcott said:
http://www.tommti-systems.de/go.htm...ain-Dateien/reviews/languages/benchmarks.html
Why is C# 500% slower than C++ on Nested Loops ???
Will this problem be solved in the future???
In general, such kind of micro-benchmarks have little or no value, in this
particular case, it shows that the C# language compiler could have done a
better job in optimizing the IL.
To prove it, here are the results of the nested loop run comparing C++,
C++/CLI and C#.
//C++ native (Compiler version 13.00)
Nested Loop elapsed time: 6048 ms -1804337152
//C++ managed - compiler options /clr /O2 /EHsc (14.00)
Nested Loop elapsed time: 6047 ms -1804337152
//C#
v1.1
Nested Loop elapsed time: 19800 ms - -1804337152
v2.0
Nested Loop elapsed time: 21050 ms - -1804337152
See, the native C++ and managed C++ results are the same, this indicates
that it's not a JIT issue but an IL issue.
When comparing the generated IL of both C# and C++/CLI, it's the C++/CLI
language compiler who did a better job than C#. However, for the
'Exceptions" case, it's C# who is the clear winner (managed code), so
suppose this is the result of the differences in priorities and constraints
set by the different language teams.
Willy.