Mathematics I / Reproducibility and Good Practice
Practice question · Multiple choice

Vectorising usually gives a large speed-up, but sometimes almost none. Why does replacing a loop with an array operation sometimes fail to help?

Hints
  1. Try to vectorise xn+1=f(xn)x_{n+1} = f(x_n).
  2. Ask what the machine is waiting for when the arrays are enormous.
Show the answer

A. When each step depends on the previous result, or memory is the limit

Why

Vectorising removes per-iteration interpreter overhead. Where that overhead was not the bottleneck — a genuine dependency chain, or a memory-bound operation — there is nothing for it to remove.

Read the lesson: Reproducibility and Good Practice →

Practise Reproducibility and Good Practice

The app has 5 more questions on this lesson, and keeps your place in the course. Mathematics I is free to start.

More questions on Reproducibility and Good Practice