Coffeehouse Post

Single Post Permalink

View Thread: is managed code faster than native?
  • User profile image

    , Sven Groot wrote

    Whether managed or native is faster has no simple answer. With native code, it is possible to perform more optimizations so it is possible to write faster code than with managed. However, in practice it may be require extremely complex and hard to maintain code to actually beat managed code. 

    In my C++ code all strings are in std::wstring and I am making a lot of use of unique_ptr<class>. And since I do a lot of function calls which return these types, there must be a lot of constructors and destructors being called.  Compared to C# simply returning a reference.