HackerTube
HomeLongsLikedHistoryWatch laterCategoriesPlaylistsSettings

Sorting Algorithms: Speed Is Found In The Minds of People - Andrei Alexandrescu - CppCon 2019

CppCon7 HN recommenders · recommended in 6 months, 2019-2024
YouTube
184K views · 7 years ago · talk · evergreen

Andrei Alexandrescu's CppCon 2019 talk revisits sorting, showing how branchless tricks, hybrid strategies and a cost metric can speed up std::sort-style algorithms on modern hardware.

HN recommends it as an entertaining talk that starts simple and goes deep on practical performance optimization.

Algorithms & data structuresSoftware performance & optimizationC, C++, Rust, Go & systems languages#sortingalgorithms#c++#branchmisprediction#optimization#cppcon

11 comments from Hacker News

@jiggawatts2024 · in “Algorithms for Modern Hardware”

The FAANGS certainly have people doing this kind of work. For example, Andrei Alexandrescu has a bunch of keynote talks at CPPCon where he talks about 1-4% speed optimisations he makes to the std library at Facebook. ▶ this video I also like the talk by Nicholas Ormrod “The strange details of std::string at Facebook": link

CitesView on HN
@bboreham2023 · in “Ask HN: Programming Courses for Experienced Coders?”

I really enjoyed “Speed Is Found In The Minds Of People”, a talk by Andrei Alexandrescu. At first he is just showing simple stuff, but stay with it, he goes deep. ▶ this video

Strongly recommendsView on HN
@r_sreeram2023 · in “Airlines Are Just Banks Now”

Here's an excellent example of what GP said: ▶ this video (long video, skip to 26:00 if you are in a hurry) The key is that code isn't running in a vacuum. It's operating on data (or controlling systems, etc). A smaller amount of code may be operating on the data in an inefficient manner, whereas a larger amount may be doing it more efficiently. In the above talk, this contrast is very stark, because the "more code" version does some stuff and then does the exact thing the "less code" version does, yet is faster. This kind of thing is common enough (albeit less stark than in the above example), that "less code is faster" is not a great "default" assumption to make.

RecommendsView on HN
@jiggawatts2023 · in “Ask HN: What's the best lecture series you've ever seen?”

Not exactly a lecture series, but Andrei Alexandrescu has had some fantastic keynote presentations at CppCon. I don't even program in C++ any more, but I've watched these more than once, they're entertaining, approachable, and inspiring: Speed Is Found In The Minds of People ▶ this video std::allocator Is to Allocation what std::vector Is to Vexation link An actual lecture series I've enjoyed watching is "The WE-Heraeus International Winter School on Gravity and Light", which covers General Relativity using modern mathematical approaches: link Again, I haven't done physics in 20 years, but I've found it surprisingly easy to follow because it is so clearly presented.

Strongly recommendsView on HN
@thomas432020 · in “Ask HN: What do you recommend for optimization and profiling?”

Do you have some more detaile about your app? I use perf, sysprof, trace32, visual studio profiler for profiling, but this highly depends on your environment. These assorted links might be interesting to you: - link - ▶ this video - link - link

CitesView on HN
@lumberjackstian2020 · in “Hoare’s Rebuttal and Bubble Sort’s Comeback”

I'm not sure about much analysis and theory that explicitly captures branch prediction, but in last year's cppcon keynote Andrei offered a possible metric [0] where he takes into account the average "distance" between two subsequent array accesses. It's basically, (C(n) + M(n) + kD(n)) / n Where M is moves, C is comparisons, k is a some constant, and D is "distance". [0]: ▶ this video

CitesView on HN
@jeffreygoesto2020 · in “Folly – Faceboook’s open source C++ library”

Well, this argument goes both ways, a generic implementation can never leverage special properties of your data. See i.e. Alexandrecu's talk [0] at about 1:05ff. If as a company you have special use cases or guidelines, you may easily benefit from libraries using these properties. [0] ▶ this video

CitesView on HN
@jacobolus2020 · in “Why is quicksort better than other sorting algorithms in practice? (2013)”

I enjoyed Alexandrescu’s CppCon 2019 talk “Speed Is Found In The Minds of People” About optimizing generic sorting routines for modern hardware. ▶ this video

RecommendsView on HN
@nestorD2019 · in “Infectious Executable Stacks”

In his talk "Speed Is Found In The Minds of People" [0], Andrei Alexandrescu tries to make a sort really fast for medium sized vector and then closes on thoughts on this precise distinction. If this question intress you, it is worth watching. [0]: ▶ this video

RecommendsView on HN
@planteen2019 · in “Mispredicted branches can multiply your running times”

The article is C++, so not sure why you are bringing up AOT/JIT since it doesn't apply here. And clearly there is a large gain possible by doing a calculation rather than a conditional with a high entropy result, otherwise, the article's mentioned speedup wouldn't have happened. A PGO feedback loop isn't going to do anything on a high entropy conditional. I saw a great talk at CppCon 2019 by Andrei Alexandrescu about speeding up std::sort. He does this same trick among others to speed up the C++ std library sort routine. ▶ this video

RecommendsView on HN
@United8572019 · in “Engineering a Sort Function (1993) [pdf]”

If you're interested in these types of implementation/optimization details, Andrei Alexandrescu gave a great talk at this year's CppCon about practical sorting, e.g. when to break out of quicksort to something else: ▶ this video

RecommendsView on HN
'Fastware' - Andrei Alexandrescu [ ACCU 2016 ]1:02:17

'Fastware' - Andrei Alexandrescu [ ACCU 2016 ]

ACCU Conference
34K views • 10 years ago
CppCon 2014: Chandler Carruth "Efficiency with Algorithms, Performance with Data Structures"1:13:41

CppCon 2014: Chandler Carruth "Efficiency with Algorithms, Performance with Data Structures"

CppCon
235K views • 12 years ago
CppCon 2015: Andrei Alexandrescu “std::allocator...”1:12:27

CppCon 2015: Andrei Alexandrescu “std::allocator...”

CppCon
196K views • 11 years ago
2013 Keynote: Chandler Carruth: Optimizing the Emergent Structures of C++1:33:02

2013 Keynote: Chandler Carruth: Optimizing the Emergent Structures of C++

CppNow
34K views • 13 years ago
CppCon 2016: Chandler Carruth “High Performance Code 201: Hybrid Data Structures"55:49

CppCon 2016: Chandler Carruth “High Performance Code 201: Hybrid Data Structures"

CppCon
119K views • 10 years ago
C++Now 2018: You Can Do Better than std::unordered_map: New Improvements to Hash Table Performance1:30:53

C++Now 2018: You Can Do Better than std::unordered_map: New Improvements to Hash Table Performance

CppNow
63K views • 8 years ago
CppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”59:34

CppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”

CppCon
137K views • 9 years ago
Plenary: Performance Matters - Emery Berger - CppCon 20201:01:09

Plenary: Performance Matters - Emery Berger - CppCon 2020

CppCon
32K views • 6 years ago
CppCon 2015: Chandler Carruth "Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My!"1:29:54

CppCon 2015: Chandler Carruth "Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My!"

CppCon
188K views • 11 years ago
High-performance Tree Wrangling, the APL Way // Aaron Hsu // Dyalog '1830:37

High-performance Tree Wrangling, the APL Way // Aaron Hsu // Dyalog '18

Dyalog User Meetings
6K views • 7 years ago
CppCon 2017: Fedor Pikus “C++ atomics, from basic to advanced.  What do they really do?”1:14:22

CppCon 2017: Fedor Pikus “C++ atomics, from basic to advanced. What do they really do?”

CppCon
288K views • 9 years ago
15 Sorting Algorithms in 6 Minutes5:50

15 Sorting Algorithms in 6 Minutes

Timo Bingmann
29.4M views • 13 years ago
Stephan T. Lavavej “Floating-Point <charconv>: Making Your Code 10x Faster With C++17's Final Boss”1:00:17

Stephan T. Lavavej “Floating-Point <charconv>: Making Your Code 10x Faster With C++17's Final Boss”

CppCon
41K views • 7 years ago
C++ and Beyond 2012: Herb Sutter - atomic Weapons 1 of 21:21:13

C++ and Beyond 2012: Herb Sutter - atomic Weapons 1 of 2

alexsmail
71K views • 9 years ago
CppCon 2017: Chandler Carruth “Going Nowhere Faster”1:00:58

CppCon 2017: Chandler Carruth “Going Nowhere Faster”

CppCon
113K views • 9 years ago
Can C++ be 10x Simpler & Safer?  - Herb Sutter - CppCon 20221:54:00

Can C++ be 10x Simpler & Safer? - Herb Sutter - CppCon 2022

CppCon
277K views • 3 years ago
CppCon 2015: Sean Parent "Better Code: Data Structures"1:04:00

CppCon 2015: Sean Parent "Better Code: Data Structures"

CppCon
106K views • 11 years ago
Abseil's Open Source Hashtables: 2 Years In - Matt Kulukundis - CppCon 201954:01

Abseil's Open Source Hashtables: 2 Years In - Matt Kulukundis - CppCon 2019

CppCon
22K views • 7 years ago
CppCon 2019: Emery Berger “Mesh: Automatically Compacting Your C++ Application's Memory”36:10

CppCon 2019: Emery Berger “Mesh: Automatically Compacting Your C++ Application's Memory”

CppCon
15K views • 7 years ago
CppCon 2019: Matt Godbolt “Path Tracing Three Ways: A Study of C++ Style”55:42

CppCon 2019: Matt Godbolt “Path Tracing Three Ways: A Study of C++ Style”

CppCon
77K views • 7 years ago