Info

space–time trade-off, also known as time–memory trade-off or the algorithmic space-time continuum in computer science is a case where an algorithm or program trades increased space usage with decreased time. Here, space refers to the data storage consumed in performing a given task (RAM, HDD, etc.), and time refers to the time consumed in performing a given task (computation time or response time).

It’s important to examine how this trade-off affects your program. Sometimes, the effect is very positive and a bit of extra space can increase the CPU time 2x or 5x. Sometimes, the trade-off is linear. Sometimes it’s way worse.