Tagged articles
branch prediction
12 articles · Page 1 of 1
The article explores how Dubbo’s ChannelEventRunnable code was optimized by separating the frequently‑taken ChannelState.RECEIVED case into its own if statement, compares the runtime efficiency of pure if‑else, mixed if‑switch, and pure switch structures, and explains the underlying CPU branch‑prediction and instruction‑pipeline mechanisms that affect these choices.
CPU optimizationDubboJava performance
0 likes · 15 min read

The article explains how performance can be dramatically improved by keeping frequently used data in CPU registers instead of memory, understanding basic assembly syntax and instruction types, using branch‑prediction hints, and exploiting the CPU pipeline to reduce stalls and wasted cycles.
CPU registersPipelineassembly language
0 likes · 12 min read

Profile‑Guided Optimization (PGO) collects runtime profiling data to recompile programs for higher performance, reducing branch mispredictions and improving code layout; Go gained built‑in PGO in 1.21 with typical 5 % gains, while C++ sees 15‑18 % QPS improvements and devirtualization benefits, and future work aims at deeper block ordering and register allocation.
C++GoPGO
0 likes · 16 min read

This article explains how the Linux kernel’s likely and unlikely macros, which wrap GCC’s __builtin_expect, guide branch prediction to improve cache utilization and pipeline efficiency, and demonstrates their impact with sample code and assembly analysis.
C++Linux kernelbranch prediction
0 likes · 7 min read

This article explains how the Linux kernel's likely and unlikely macros, which wrap __builtin_expect, guide the compiler's branch prediction to improve cache usage and pipeline efficiency, and demonstrates the effect with sample C code and assembly output.
Linuxbranch predictionlikely
0 likes · 9 min read

The article examines a puzzling StackOverflow case where sorting a random array before summation yields a six‑fold speedup, explains the phenomenon through CPU five‑stage pipeline fundamentals, structural, data, and control hazards, and shows how branch prediction and operand forwarding mitigate the performance loss.
CPUPipelinebranch prediction
0 likes · 16 min read

The article explains how V8’s built‑in methods, originally placed far from JIT‑generated code, cause costly branch‑prediction failures on 64‑bit CPUs, and how copying these snippets into a nearby memory region reduces mispredictions and improves performance at a modest memory cost.
CPUJITV8
0 likes · 4 min read


ITPUBApr 8, 2021 · Fundamentals
This article explains how the invention of assembly‑line manufacturing parallels modern CPU pipelines, why processing an ordered array can be nearly ten times faster than an unordered one, and shows a practical bit‑wise optimization to eliminate costly if‑statements for high‑performance code.
CPUPipelineassembly line
0 likes · 10 min read

The article demonstrates how Top‑down Micro‑architecture Analysis Methodology (TMAM) can quickly pinpoint CPU bottlenecks—such as front‑end, back‑end, and bad speculation stalls—in a simple C++ accumulation loop, and shows that applying targeted compiler, alignment, and branch‑prediction optimizations reduces runtime by roughly 34 % while increasing retiring slots.
C++CPU performanceTMAM
0 likes · 20 min read


ITPUBJul 31, 2020 · Backend Development
This article reviews several of the most popular Java questions on StackOverflow, explaining branch prediction for sorted arrays, why char[] is safer than String for passwords, handling NullPointerException, deterministic random strings, historic timezone quirks, creating an uncatchable exception, and the differences between HashMap, TreeMap and LinkedHashMap, highlighting practical lessons for developers.
Exception HandlingHashMapJava
0 likes · 10 min read


ITPUBOct 8, 2017 · Fundamentals
This article explains the different types of CPU branches, how branch prediction works, and presents practical techniques—including branch‑prediction hints, SETcc/CMOVx instructions, and branch‑less coding—to reduce the performance impact of conditional and indirect jumps in x86 programs.
CMOVCPU pipelineSETcc
0 likes · 14 min read


ITPUBAug 22, 2017 · Fundamentals
This article explores x86 performance optimization by comparing a simple sum‑of‑array loop with and without a pre‑sort step, demonstrating how branch prediction and cache behavior can make seemingly redundant code run up to three times faster, and outlines practical benchmarking principles and common pitfalls.
CPU cyclesbenchmarkingbranch prediction
0 likes · 14 min read
