Solution2: C# Is Faster Than C++!!!!!1!!! with Clinton Ingram
HTML-код
- Опубликовано: 17 янв 2025
- Modern .NET is full of performance features, some of which aren't available in even the fanciest native compilers. See how .NET's runtime, libraries, and tools invalidate the old argument that "C/C++ is faster".
Join us on Discord: / discord
JetBrains: www.jetbrains....
O'Reilly: www.oreilly.com
I remember microsoft saying that coding in rust / c++ cost something like 10x what it does on C#. So the idea is to code almost everything in c# because it's cheap and get decent performance anyway. And then only recode the most performance critical part of your code if you can justify the cost.
Depends on what you’re doing. I’d say most people and most applications will never cross over one way or another. I think Mark Rusinovich said it best - if you can live with GC, then C# is likely performant enough for you. If not - this is where Rust and C++ come.
As soon as you need to work with memory then c++ is faster than anything, this is basically because you need to understand memory coding C++ and by doing that you can code so that compiler are able to optimize for cache and simd. Also you will use a lot less memory
That's how I've always used that mechanism... You can Invoke C from C# for certain things like when you need close to metal atomics or kernel access... I know I've made C# GO REALLY REALLY FAST...
I find that managing your stack properly you can shrink and speed up C# code...
I've been working from this model since the days of VB 5 and needing to still write rendering and calc routines in C/C++
"Everybody is going to Bluesky now..." Hmmmm...
Smartly expressed!
So…you are comparing some auto-vectorized C++ code with different, hand written SIMD C# code? I have no dog in this fight, but it seems apples to oranges to me.
Did you miss the entire point of the video?
He explicitly says it's a joke because someone can take his C# algorithm and do it in C++ and get the same or better results.
He also spends a lot of time showing different C++ compilers get different performance results, so saying 'Language X is faster than language Y' doesn't even make sense.
Couldn't have said it better myself :)
Just to be clear, I compared auto-vectorized C++ to hand-optimized C# scalar code and hand-written C++ SIMD code to hand-written C# SIMD code, but yes, they were different, and that was part of the point.
I did not finish watching it, once I saw enough to realize that the title is clickbait. I suppose it was useful (albeit very much expected) demonstrating that the different compilers would optimize to a different degree of success. Which of course has nothing to do with C#.
Well first of all title itself is already screaming "THIS TITLE IS NOT SERIOUS" at you. You don't even have to watch video for this.
Secondly, it was stated right from the start that boldly comparing languages in "speed" isn't a good thing as things change.
And thirdly: if you care enough for performance, C# can give you performance and you don't have to write every piece of performance sensitive code in C/C++.
The point is that it's not about "oh, this is managed thus it is slow" but rather about how the thing itself is actually written. More and more stuff in .Net runtime itself is being rewritten in C# because it is more portable, easier to read and write and can give you comparable speed with C/C++.
Obviously each case is different and things change (which was clearly stated in the first minutes of presentation) but it is important that you can just do it in the language you like. I do really like the fact that .Net has a good approacheable SIMD api and this might bring more people into SIMD camp overall (or even into C# if you're a C++ dev).
@@peperudpeperudski1911 you should have. Because C++ guys did make a manual AVX2 implementation. He just came up with a better one using C# intrinsics.
Thank you so much for this amazing video! A bit off-topic, but I wanted to ask: My OKX wallet holds some USDT, and I have the seed phrase. (alarm fetch churn bridge exercise tape speak race clerk couch crater letter). What's the best way to send them to Binance?
A compiled language is faster than a interpreted language. I think that is the key difference.