Get the latest tech news

Four Kinds of Optimisation (2023)


Premature optimisation might be the root of all evil, but overdue optimisation is the root of all frustration. No matter how fast hardware becomes, we find it easy to write programs which run too slow.

Famously, if you choose an unfortunate “pivot” when implementing quicksort, you’ll find that it is very non-quick (e.g. you can make it as slow on already-sorted data as the selection sort above). When I was working on error recovery in grmtools, I found that simply reducing the most commonly allocated struct by 8 bytes in size improved total program performance by 5% — a trick that, from memory, I repeated twice! The effectiveness of this simple technique (the core algorithm is a few lines of code) tends to stun newcomers, since the obvious problem of local optima seems like it should undermine the whole idea.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of kinds

kinds

Photo of optimisation

optimisation

Related news:

News photo

Rise of the Ronin team apologises as players blast "horrible" optimisation

News photo

'There Are Two Kinds of Credit Cards'

News photo

Balatro developer responds to AI art drama, stating it "does real harm to artists of all kinds"