~/lightning

Branch prediction case study [Lightning Talk]

Lightningat Core C++ 2025 · on Sunday, 2025-10-19· [c-and-cpp]
links:none on file
slides:none on file

Case study of a summing loop that tests values >128 shows surprising compiler effects: a StackOverflow example is compiled without a branch when the compiler emits cmovg conditional move, so sorted vs unsorted arrays show no difference on GCC 15.2 and MSVC. Older compilers keep a branch so sorted data runs about 2x faster on GCC 14.2, letting one estimate misprediction cost. Lesson: test on the target compiler and hardware and prefer branch-friendly code patterns.

AI-written summary · about

~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.