loop unrolling does: trades code size for reduced loop overhead

Can we speed up our computer programs?

Image: Christian David, CC BY-SA 4.0, via Wikimedia Commons

loop unrolling does: trades code size for reduced loop overhead

Can we speed up our computer programs?

Imagine you're baking cookies and you have to repeat mixing ingredients and baking each batch. You could do it one by one, or you could mix all the ingredients at once and bake multiple batches together.

By mixing all the ingredients at once and baking multiple batches, you're doing more at once, which can save time. This is like loop unrolling in computer programs, where you do more work in each step to finish faster.

Example

Instead of baking 10 batches one by one, you mix all ingredients for 10 batches at once and bake 10 batches together.

Remember this

Loop unrolling speeds up programs by reducing the repetitive overhead of starting and ending each loop iteration.

Related concepts

Swipe through 100 ML concepts daily

Open Pocket Polymath