Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
CPU Pipelines and Branch Prediction: Why Is a Sorted Array Processed Faster?
A sorted array is processed faster because the ifs inside the loop become predictable and the CPU doesn't have to flush its pipeline. A 9.4x gap on one million orders, why the JIT won't emit cmov inside a loop, branchless summing with a bit mask, dependency chains and ILP, and why Spectre exists.
How a Line of C# Runs on the CPU: From Source to IL, Assembly and Instructions
A line of C# reaches the CPU through two translations: Roslyn turns it into IL, and at run time the JIT turns that into machine code for the machine's ISA, which the CPU runs in a fetch-decode-execute cycle. We read the 30-byte x64 Tier-1 code of TotalQuantity line by line, compare it with its ARM64 version, the 789-byte decimal version and an unoptimized Tier-0 measurement, and explain the x86-64-v2 baseline in .NET 11.