How to OPTIMIZE YOUR CODE!

preview_player
Показать описание


Chapters
---------------
0:00 - Optimizing Performance
2:30 - Finding slow code
4:53 - The importance of hardware
7:24 - CPU vs GPU
9:01 - Compilers and settings
9:44 - Timers
11:14 - Profiling with Optick
13:18 - PVS Studio for optimization
14:39 - Next steps to optimize

This video is sponsored by PVS Studio.
Рекомендации по теме
Комментарии
Автор

Hope y'all enjoyed the video! ❤️ What's your favourite strategy to optimize your code?

TheCherno
Автор

Easy steps to make code run faster:
1) Don't trust compiler
2) write your own assembly
3) Don't trust OS
4) Write your own OS
5) Don't trust processor's BPU and OoOE
6) roll your own processor
7) redefine the universe
8)

SkullCloud
Автор

Optmization is easy, just give your customers a top tier pc.

artemisDev
Автор

Empty files usually execute faster than files that contain anything written by me

nathanlloyd
Автор

Using 1 thread on a quad core is like driving a car with 3 dead cylinders.

xeridea
Автор

I found your channel in my recommendations today and I really like all of the devlogs for Hazel. I love the physics demos and the editor ui a lot.

Mampinator
Автор

My key strategy for optimization is :
1. Try not to use too much library functions without knowing what they do, most of the time a lot of functions have a lot of build up behind the scenes which in a larger application could affect the performance..
2. C is the fastest so try to write code in such a way that resembles more towards c style for example if you get away with using an array for hashing instead of map then do it. It will greatly improve performance.
3. I/O operations are your enemy, so you want to avoid as much as I/O possible.
4. Avoid logical impurities like too much branching and recursion. Use guard clauses, bitwise operations and optimal algorithms.
5. Try to use availability of infinite memory to speed up calculations. memoizing calculations that you doing again and again can help greatly improve.

sangamo
Автор

my projects weren't nearly as big as hazle yet but until now i was always able to tell which methods take the longest by just looking at them. sometimes i deliberately write non-performant code, because it's more readable and i just wanna get stuff done, but then i leave a comment so i remember to improve it later when i need the power, and ofc when i actually wanna finish the thing

Beatsbasteln
Автор

Родненькие наши ковры, прям настроение поднимает.

jerrody
Автор

One thing I personally do is prototype in C#, then compare performance with C++. I'm happy when I beat C# by 10-20%, the initial C++ code is often tens to hundreds times slower.Using a custom memorypool is also a good idea to boost performance, if you're doing a lot of memory allocations.It would be great if you could make a video on how to actually make your code faster, not just profile it.

TheExstud
Автор

Really enjoyed the video today. Was only teaching some students about service level agreements and measuring system performance the other day. I'm glad the use of your own performance checks with timers hasn't become totally obsolete. Would be really interested to hear more from you on opengl performance/timers.

williamclifford
Автор

Your videos have become so high quality over the years

nathanosullivan
Автор

Casey Muratori recently uploaded an excellent video series on optimizations.

patryk_
Автор

imo the "Producing Wrong Data Without Doing Anything Obviously Wrong" paper is also something that pretty interesting to read through if you REALLY really care :>

drip
Автор

So i have seen Molly Rockets video about non-pessimization (The Refterm Lecture), and in there he explains that in order to optimize something, you have to write code that isnt pessimized, or in other words you have to write the code that does the minimum amount of work you need to do. For example: dont write an OS if all you need to do is print something to the screen! Or using a library that does extra stuff you DONT need or not even knowing WHAT a library does.

wChris_
Автор

I feel something is different about this episode, IDK what is it, but I love it!

mohammednihad
Автор

Thank you for sharing your expertise!!!

brandonsamuelcruzsilva
Автор

Writing a timer that tracks a frame and sub timestamps are soo usefull. Timer, number of calls and memory footprint are so basic you should always track them. Makes pro and cons about code measurable.

MrHaggyy
Автор

Great video!
I wonder if you implemented some custom allocator. I've heard it can really speed things up. Good luck!

gommito
Автор

Usually RW is the bottleneck - less OOP more DOD, less abstractions more cache coherency - simple.

heatblazer