LLVM and Clang Optimizations: Make Your Code 10X Faster

  Рет қаралды 2,578

The Coding Gopher

The Coding Gopher

Күн бұрын

Пікірлер: 15
@TheCodingGopher
@TheCodingGopher 3 күн бұрын
Looking to upgrade my audio setup with a Blue Yeti USB microphone! If you'd like to support the channel, you can buy me a coffee here: ko-fi.com/thecodinggopher.
@debbie8062
@debbie8062 4 күн бұрын
very well made! your vids are getting better after each post, keep it up :)
@TheCodingGopher
@TheCodingGopher 4 күн бұрын
🚀!
@architmishra015
@architmishra015 3 күн бұрын
Damn! That was such an easy explanation of the underlying working of clang. Would love to see one on LLVM itself. How it converts the code to IR and then machine executable and how can we make our own compiler using it
@TheCodingGopher
@TheCodingGopher 3 күн бұрын
Thanks for watching! I made a video called `What is LLVM: How It Powers Modern Compilers and Optimizes Code`. It covers all the fundamentals of LLVM
@playea123
@playea123 3 күн бұрын
All hail Chris Lattner
@TheCodingGopher
@TheCodingGopher 3 күн бұрын
A true legend
@josephliu8802
@josephliu8802 Күн бұрын
@TheCodingGopher Are all Clang optimizations mentioned here available in GCC?
@TheCodingGopher
@TheCodingGopher 23 сағат бұрын
Not all optimizations available in Clang have a direct equivalent in GCC, but the core optimizations (i.e. the -O1, -O2, -O3 optimizations in the video) are shared between both compilers
@Kiyuja
@Kiyuja 3 күн бұрын
maybe this is outdated info but isnt O3 known to cause unstable code? AFAIK only O1 (size) and O2 (speed) are regarded as "safe" optimization flags
@TheCodingGopher
@TheCodingGopher 3 күн бұрын
I'd say what sets -O3 apart is its aggressive speculative optimizations. -O3 tends to assume well-defined behavior and may reorder / remove code based on these assumptions (i.e. introducing instability, especially in edge cases like undefined behavior / infinite loops). Definitely use -O1 or -O2 if you want to prioritize safety
@debbie8062
@debbie8062 3 күн бұрын
Could you clarify or share recent examples of situations where -O3 optimization might cause instability?
@Kiyuja
@Kiyuja 5 сағат бұрын
@@debbie8062 I can infact not, as I never used O3 myself. I do however have friends that told me and it also came up again in recent years when the Mario 64 decomp landed and people found out "oh no the US and JP Rom use -g flag, only the Pal version uses O2" . Now why didnt they use O3? Because its famous for doing risky stuff that can impact stability (funfact on the N64 O1 would've been much better since the console is so horribly bandwidth limited)
@Kiyuja
@Kiyuja 5 сағат бұрын
@@TheCodingGopher yeah thats what I've been told as well. I wonder whether Rust's forced expressiveness can reduce this as you are basically forced to tell the compiler exactly what you want, therefore the compiler might be able to make better assumptions.
A New Era for C and C++? Goodbye, Rust?
9:08
Travis Media
Рет қаралды 94 М.
How many people are in the changing room? #devil #lilith #funny #shorts
00:39
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 34 МЛН
Farmer narrowly escapes tiger attack
00:20
CTV News
Рет қаралды 13 МЛН
Mini Project: How to program a GPU? | CUDA C/C++
12:53
0Mean1Sigma
Рет қаралды 23 М.
this is what happens when you let the intern write code.
12:50
Low Level
Рет қаралды 270 М.
Linus just made this run 2.6% faster in Linux
1:48
Machinely
Рет қаралды 12 М.
LLVM vs GCC: Which Compiler RULES the Future of Programming?
7:47
The Coding Gopher
Рет қаралды 40 М.
Why Would Anyone Use Functional Programming?
4:08
The Coding Gopher
Рет қаралды 7 М.
why rust libraries may never exist.
7:26
Low Level
Рет қаралды 280 М.
API vs SDK: What’s the REAL Difference?
5:01
The Coding Gopher
Рет қаралды 2,2 М.
Programming Is Cooked
9:30
ThePrimeTime
Рет қаралды 328 М.
Creating Your Own Programming Language - Computerphile
21:15
Computerphile
Рет қаралды 150 М.
How many people are in the changing room? #devil #lilith #funny #shorts
00:39