Johnder Perez

Step 2 of 6

The CPU and the execution cycle


The processor repeats one loop billions of times a second: fetch the next instruction, decode it, run it. It keeps a few values in super-fast slots called registers. Everything else lives in slower memory.

Why it matters when you build with AI: This is why 'just loop over everything' works fine with 100 rows and falls over with 1 million. The work is real, even if the code looks short.

Quick check

A loop over 1 million rows is slow but the code is only 3 lines. Why?

← Previous step Next: Stack vs. heap memory →