Use these C++ loops to make your code faster

Опубликовано: 28 Февраль 2025
на канале: Zen Sepiol
5,383
117

There are many different C++ for loops. Learn which one is the fastest and how to avoid common mistakes.
I show different alternatives including range-based for loops and standard algorithms. Afterwards, those for loops are benchmarked against each other.

00:00 Intro
00:30 The task
01:33 The classic loop
04:19 The iterator loop
06:10 The range based loop
07:47 Standard algorithms
10:35 The comparison

Tools that I use:
https://www.virtualbox.org/
https://kubuntu.org/
https://code.visualstudio.com/
https://llvm.org/
http://clang.org/
https://mesonbuild.com/index.html

In code:
https://github.com/renatoGarcia/icecr...
https://github.com/ZenSepiol
https://github.com/ocornut/imgui
https://github.com/epezent/implot