Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Raymond Chen (aka "fixed more Windows bugs than you've had hot dinners") and Rico Mariani (aka "Mr .NET Performance") have been running a great series of articles where they write and then optimize the same application in two different languages: native C++ and managed C#. The easiest starting point for the two sets of articles is "Performance Quiz #6 -- Chinese/English Dictionary reader".
There's a lot of good information in both the articles and the reader comments, and if you've got the time they're well worth studying for hints on how to write and benchmark high-performance code. The summary is a compelling argument for .NET:
So yes, C++ code can be faster than C# code — but when you look at all the work Raymond had to go through to achieve that, you have to ask yourself "is it worth it?"
Edit: Jeff Atwood has posted a graph illustrating the diminishing returns of Raymond's optimization efforts.
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in