3 ms·
This is not same for all cases. For example scientific and high performance computing, image processing, or other tasks which need short run times or applicatio
by bayindirh 9y ago
This is not same for all cases. For example scientific and high performance computing, image processing, or other tasks which need short run times or applications where a single digit optimization results in hours of run time difference is always worth it.
Also, since C++ is native, very memory efficient data structures can be written. This property can be leveraged to write very small, very efficient and very resilient loops to be written which can run for months at a time, and since you have the absolute control over memory management, you can prevent unwanted bloating or leaks pretty easily.
Last, but not the least; CPUs weren't that powerful 10-15 years ago. My desktop computer was as fast as the first Raspberry Pi. Python, JS, even Java were very unpleasant experiences back then.
- pedasmith 9y agoWell, you can spend 5 months writing your software in C++, and a month fixing your bugs and doing a bit of optimization. Or you can spend 3 months writing C# or other modern language and have another 3 months to optimize, all the while enjoying substantially faster compile times and super easy refactoring.
- bayindirh 9y agoThis is not an apples to apples comparison. I've given examples from runtime, not from development time. OTOH, refactoring in C++ is not hard, at least from my experience. With some knowledge of the language, everyone can write reasonably bug-free C++ (or any other language) application in one go. Compilation in C++ is a different story. C# is not native. It's converted to CLI (was that the name, I don't use Win32 for ~15 years), then JIT compiles it to machine code, and optimizes over and over in every execution. Yes, C# is reasonably fast, but it's not native, cross platform (mono doesn't count), and designed to be a systems programming language. People tend to think C++ is overly verbose, no. Win32 programming model forces simple operations to be long and time consuming for a programmer to implement. Opening a file, serial port, or anything is a single line, because of the (while not everyone likes it) "everything is a file" philosophy, which makes UNIX and C++ much easier, verbose, and accessible.
- pjmlp 9y agoC# is surely native as well. It can be compiled to native code just like C++ via NGEN, .NET Native, CoreRT, IL2CPP, Bartok, Mono AOT. Or if you prefer, C++ is not native. It's converted to LLVM bitcode, OS/400 TIMI, WASM,.... Lets not mix languages with implementations.
- bayindirh 9y ago> It can be compiled to native code... In that sense, you are absolutely right. However, for simplicity I only thought about the out of the box experience, or by the de-facto implementation of the said languages, since it’s the most popular usage scenario as well.
- pjmlp 9y agoWell, since Windows 8 .NET store apps don't support JIT, they only run AOT compiled to native. And NGEN is a standard component of the .NET SDK since the beta days. So AOT compilation has been part of the default tooling since ever.
- bayindirh 9y agoWell, I’m not very knowledgeable about Windows world, as I said before, I’m not using Windows for 15 years or so. So, my bad, sorry.
- pjmlp 9y agoIf you, or others want to know a bit more about it, NGEN https://docs.microsoft.com/en-us/dotnet/framework/tools/ngen-exe-native-image-generator https://docs.microsoft.com/en-us/dotnet/framework/tools/ngen... AOT Compilation for Windows 8.x store apps, based on Singularity's Bartok compiler https://channel9.msdn.com/Events/Build/2012/3-005 https://channel9.msdn.com/Events/Build/2012/3-005 https://channel9.msdn.com/Shows/Going+Deep/Mani-Ramaswamy-and-Peter-Sollich-Inside-Compiler-in-the-Cloud-and-MDIL https://channel9.msdn.com/Shows/Going+Deep/Mani-Ramaswamy-an... AOT Compilation for Windows 10 store apps, using Visual C++ backend https://channel9.msdn.com/Shows/Going+Deep/Inside-NET-Native https://channel9.msdn.com/Shows/Going+Deep/Inside-NET-Native https://docs.microsoft.com/en-us/dotnet/framework/net-native/ https://docs.microsoft.com/en-us/dotnet/framework/net-native...