frednaar Posted July 4, 2011 Share Posted July 4, 2011 Here' a recent article on C++ vs C# performance. I know this will not apply to LW for most cases but I thought it would be interesting to share http://www.codeproject.com/KB/cross-platform/BenchmarkCppVsDotNet.aspx If someone would like to do a similar test for LW (maybe also adding LUA to the test) it would be great (I don't believe I have the skills for doing it myself) Fred Quote Link to comment Share on other sites More sharing options...
TheoLogic Posted July 4, 2011 Share Posted July 4, 2011 Useless comparison: - VS2008 has secure SCL enabled by default in release. This is a performance impact of 2X in release builds. - hash_map is not even standard C++. Use C++0x unordered_map instead. - No garbage collector in play? You should also remove the C++ allocating and deallocating time... - std::string is slow in VS2008, duh no move semantics. Test this in VS2010. - Port C# to C++ one on one? Even the other way around this is a bad practice. I use C# often, even more as C++ lately, but saying the performance impact is minimal with these kind of test is just plain wrong! Especially for games, I needed to add a lot of caching to avoid lag... I'm not even speaking about the cold and warm starts of native .NET code. Like others stated in the comments, this isn't a real-life example. You can love up in both languages! Quote Follow me Link to comment Share on other sites More sharing options...
Canardia Posted July 4, 2011 Share Posted July 4, 2011 A good real life example is making a verlet fluid simulation. It seems it needs a lot of power, and the fastest languages can barely handle 3000 particles at 60 FPS. Interesting is that 64-bit C++ is faster in many tests than 32-bit C++, maybe it's time to start testing 64-bit Windows? With LE3 I will finally have an engine which utilizes my GeForce 8800 fully, but does it utilize my Intel quadcore CPU also fully? it seems I would need to compile LE3 as 64-bit version to find out how much faster it would be than the 32-bit version. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted July 4, 2011 Share Posted July 4, 2011 Here' a recent article on C++ vs C# performance. I know this will not apply to LW for most cases but I thought it would be interesting to share. First, I'd like to say thank you for the article. It seems to be very informative, with thorough examples. Though, apparently TheoLogic has valid reasons to think this article is rubbish Please, in the future, could you post this within the general programming forums? Since there is a constant wave of C# bashing and would be best if placed somewhere else where all languages would have equal ground for discussion. I don't think any language wants their flaws picked apart, especially if the programmers using the language already know what they are. Basically what Metatron does every week. Quote Link to comment Share on other sites More sharing options...
Canardia Posted July 4, 2011 Share Posted July 4, 2011 Basically what Metatron does every week. I think you're lying, you don't have any proof of that Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
L B Posted July 4, 2011 Share Posted July 4, 2011 Useless comparison: - VS2008 has secure SCL enabled by default in release. This is a performance impact of 2X in release builds. - hash_map is not even standard C++. Use C++0x unordered_map instead. - No garbage collector in play? You should also remove the C++ allocating and deallocating time... - std::string is slow in VS2008, duh no move semantics. Test this in VS2010. - Port C# to C++ one on one? Even the other way around this is a bad practice. I use C# often, even more as C++ lately, but saying the performance impact is minimal with these kind of test is just plain wrong! Especially for games, I needed to add a lot of caching to avoid lag... I'm not even speaking about the cold and warm starts of native .NET code. Like others stated in the comments, this isn't a real-life example. You can love up in both languages! Seems like someone hasn't read anything of the "Updates to this article" part, and jumped straight to the benchmarks. Most of your complaints are addressed there. Moreover, why don't you tell the article author instead of us? We surely won't satisfy your intentions. Quote Link to comment Share on other sites More sharing options...
L B Posted July 4, 2011 Share Posted July 4, 2011 I think you're lying, you don't have any proof of that We have, you're changing names so all references to Lumooja starting language holy wars are erased from the newcomers' minds. Quote Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted July 5, 2011 Share Posted July 5, 2011 We have, you're changing names so all references to Lumooja starting language holy wars are erased from the newcomers' minds. Hahaha. Quote Link to comment Share on other sites More sharing options...
TheoLogic Posted July 5, 2011 Share Posted July 5, 2011 Seems like someone hasn't read anything of the "Updates to this article" part, and jumped straight to the benchmarks. Most of your complaints are addressed there. Moreover, why don't you tell the article author instead of us? We surely won't satisfy your intentions. I did read the remarks, and I even quoted them . I know this reads like: "he's bashing C#", but I ain't really. I love C#.NET and very often use it. My only concerns were the things I stated above... I post this here, because it was linked here. The original author was already spoken too by other persons. I am sorry, I will not post criticism here again if it bothers some users. Quote Follow me Link to comment Share on other sites More sharing options...
Pixel Perfect Posted July 5, 2011 Share Posted July 5, 2011 People should not be so sensitive. If people want to post comparisons between languages then it's natural you are going to get feedback and it might not all be supportive. Or do we all want to go round with blinkers on: Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Mumbles Posted July 5, 2011 Share Posted July 5, 2011 it seems I would need to compile LE3 as 64-bit version to find out how much faster it would be than the 32-bit version. You have a source license for LE3 too? Even though it's not finished yet? Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
Canardia Posted July 5, 2011 Share Posted July 5, 2011 You have a source license for LE3 too? Even though it's not finished yet? Yeah but when it's ready, then I will have lots of fun with trying to optimize it I found an interesting new command in C++: alloca(), which allows you to use always stack memory, so that could be one thing to try out for maximum speed. Also compiling it with MinGW or GNU C++ should bring some more speed, and changing pointers to references (although that is not always faster, but quite often). And now I also learned that 64-bit can be faster, and not to forget that I could try to put some heavy and/or blocking CPU loops on other cores. And moving contants in front of expression. And redefining the typedef for float to double, although this increases speed only when memory is not moved around too much. And finally compiling it with Intel C++ compiler. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Mumbles Posted July 5, 2011 Share Posted July 5, 2011 And not a single mention of fortran... Welcome back... Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
Canardia Posted July 5, 2011 Share Posted July 5, 2011 Well, first I want to use all possible techniques to get the maximum speed out of C++, and if it's still too slow, then I rewrite it in Fortran, or at least parts of it Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
TheoLogic Posted July 5, 2011 Share Posted July 5, 2011 What about move semantics? Those could really optimize the engine by X! Lambda's are also perfect candidates for inlining, use them where needed... Concurrency could be a great addition, most CPU's being multi-threaded this day, using unordered_map instead of map, hashing strings, loading from binary instead of text files, ... Many thing you can do Quote Follow me Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.