Branchless Programming in C++ - Fedor Pikus - CppCon 2021
https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
Have you ever written code like this:
void f(bool b, long x, long& s) { if (b) s += x; }
Probably you have. Would you like me to tell you how much performance you left on the table? With a small change, that function could be made 2.5 times faster.
What about this code:
if (a[i] && b[i]) do_something(); else do_something_else();
Would you believe me if I told you that, under some not-so-exotic conditions, this line runs four times slower than it could be? It’s true, and I’m going to show you when and why.
This presentation will explain how modern CPUs handle computations to ensure that the hardware is used efficiently (which is how you get high performance from the processor). We will then learn how conditional code disrupts the ideal flow of computations and the countermeasures employed by the CPU designers to retain good performance in the presence of such code. Sometimes these measures are sufficient, often with the help of the compiler. But when they aren’t, it is up to the programmer to recover lost performance by coding with fewer branches.
---
Fedor Pikus
Fedor G Pikus is a Chief Engineering Scientist in the Design to Silicon division of Mentor Graphics Corp (Siemens business). His earlier positions included a Senior Software Engineer at Google and a Chief Software Architect for Calibre PERC, LVS, DFM at Mentor Graphics. He joined Mentor Graphics in 1998 when he made a switch from academic research in computational physics to the software industry. Fedor is a recognized expert on high-performance computing and C++, he presented his works at CPPCon, SD West, DesignCon, in Software Development Journal, and is also an O’Reilly author. His responsibilities as a Chief Scientist include planning the long-term technical direction of Calibre products, directing and training the engineers who work on these products, design, and architecture of the software, and research in the new design and software technologies. Fedor has over 25 patents and over 100 papers and conference presentations on physics, EDA, software design, and C++ language.
---
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk
The CppCon YouTube Channel Is Sponsored By:
SonarSource: https://www.sonarsource.com/
Видео Branchless Programming in C++ - Fedor Pikus - CppCon 2021 канала CppCon
https://github.com/CppCon/CppCon2020
---
Have you ever written code like this:
void f(bool b, long x, long& s) { if (b) s += x; }
Probably you have. Would you like me to tell you how much performance you left on the table? With a small change, that function could be made 2.5 times faster.
What about this code:
if (a[i] && b[i]) do_something(); else do_something_else();
Would you believe me if I told you that, under some not-so-exotic conditions, this line runs four times slower than it could be? It’s true, and I’m going to show you when and why.
This presentation will explain how modern CPUs handle computations to ensure that the hardware is used efficiently (which is how you get high performance from the processor). We will then learn how conditional code disrupts the ideal flow of computations and the countermeasures employed by the CPU designers to retain good performance in the presence of such code. Sometimes these measures are sufficient, often with the help of the compiler. But when they aren’t, it is up to the programmer to recover lost performance by coding with fewer branches.
---
Fedor Pikus
Fedor G Pikus is a Chief Engineering Scientist in the Design to Silicon division of Mentor Graphics Corp (Siemens business). His earlier positions included a Senior Software Engineer at Google and a Chief Software Architect for Calibre PERC, LVS, DFM at Mentor Graphics. He joined Mentor Graphics in 1998 when he made a switch from academic research in computational physics to the software industry. Fedor is a recognized expert on high-performance computing and C++, he presented his works at CPPCon, SD West, DesignCon, in Software Development Journal, and is also an O’Reilly author. His responsibilities as a Chief Scientist include planning the long-term technical direction of Calibre products, directing and training the engineers who work on these products, design, and architecture of the software, and research in the new design and software technologies. Fedor has over 25 patents and over 100 papers and conference presentations on physics, EDA, software design, and C++ language.
---
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk
The CppCon YouTube Channel Is Sponsored By:
SonarSource: https://www.sonarsource.com/
Видео Branchless Programming in C++ - Fedor Pikus - CppCon 2021 канала CppCon
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
Branchless Programming: Why "If" is Sloowww... and what we can do about it!CppCon 2017: Fedor Pikus “C++ atomics, from basic to advanced. What do they really do?”C++20: Reaching for the Aims of C++ - Bjarne Stroustrup - CppCon 2021Real-time Programming with the C++ Standard Library - Timur Doumler - CppCon 2021Advanced Algorithms (COMPSCI 224), Lecture 1CppCon 2018: Fedor Pikus “Design for Performance”[c][explained] Branchless ProgrammingLaw of Demeter: A Practical Guide to Loose Coupling - Kris Jusiak - CppCon 2021CppCon 2016: Nicholas Ormrod “The strange details of std::string at Facebook"Your New Mental Model of constexpr - Jason Turner - CppCon 2021Lightning Talk: Upgrading The Compiler Isn't Free - Andre Kostur - CppCon 2021Sorting Algorithms: Speed Is Found In The Minds of People - Andrei Alexandrescu - CppCon 2019CppCon 2017: Carl Cook “When a Microsecond Is an Eternity: High Performance Trading Systems in C++”CppCon 2017: Louis Brandy “Curiously Recurring C++ Bugs at Facebook”Dynamic Programming - Learn to Solve Algorithmic Problems & Coding ChallengesFaster, Easier, Simpler Vectors - David Stone - CppCon 2021CppCon 2017: Chandler Carruth “Going Nowhere Faster”How C++20 Changes the Way We Write Code - Timur Doumler - CppCon 2020CppCon 2015: Andrei Alexandrescu “std::allocator...”