Understanding how the CPU works

The CPU is in charge of running the central logic of your application. Even if your application is a graphics application running most of its workload in the GPU, the CPU is still going to be governing all that process. There are many different CPUs, some faster than others for certain things, others that are more efficient and consume less power, sacrificing their computing power. In any case, Rust can compile for most CPUs, since it knows how they work.

But our job here is to figure out how they work by ourselves, since sometimes the compiler won't be as efficient at improving our machine code as we are. So, let's get to the center of the processing, where things get done.

The processor has a set of instructions ...

Get Rust High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.