Skip to content
0:00 / 0:00

#branchlessprogramming#assembly#c++

Branchless Programming: Why "If" is Sloowww... and what we can do about it!

Creel

104K subscribers • 4 videos on Hallway

YouTube
  • Recommended by 2 people: 1 on Lobsters and 1 in engineering communities.
  • A classic. People kept recommending it from 2020 to 2023.

Intermediate. Assumes working knowledge.

1.7M views6 years ago2 recommendations

Systems programmingPerformance and optimizationCPUs and computer architecture

An explanation of how CPU branch prediction works and how to write branchless code in C++ and assembly to improve performance.

Support What's a Creel? on Patreon: patreon.com/whatsacreel Office merch store: whats-a-creel-3.creator-spring.com FaceBook: facebook.com/whatsacreel/ In this video we look at branchless programming. This is a technique to gain speed in our high and low level programming by avoiding branching code as much as possible. Software used to make this vid: Visual Studio 2019 Community: visualstudio.com/downloads/ OBS: obsproject.com/ Davinci Resolve 16: blackmagicdesign.com/products/davinciresolve/ OpenOffice: openoffice.org/ Gimp: gimp.org/

Why it's here

2 people recommend this

What people say. Recommended as an awesome and practical tutorial on branchless programming and conditional logic.

u/pLeThOrAxin r/ProgrammingLanguages • Recommends

On “How stupid would it be to replace an "if" statement with purely logical operators?”

They're sometimes called branchless conditionals or branchless statements. You can do it with conditional logical or algebra. link to this video awesome and practical tutorial

xtianon Lobsters • Recommends

Branchless Programming: Why “If” is Sloowww… and what we can do about it

u/wholl0pin r/C_Programming • Mentions

On “Function to convert uppercase letters to lowercase”

Take a look at this amazing video! The upper/lower case conversion is one of the examples! link to this video

u/arthurbacciin r/C_Programming • Mentions

On “A Text Editor made in C, with only ncurses as requirements”

The second is a branchless. [video

u/tandonhitenin r/C_Programming • Mentions

On “Fastest possible way to calculate distance between 2 points?”

It seems that you don't understand the performance game. Performance of a software, CANNOT be measured before it's run. Watch the following videos about optimisations to get insight as to why 1. GEMM optimisations 2. Branchless programming 3.Sorting Olympics