Cairn
guides · reference tool, not a category comparison

↩ back to Guides

How Fast Is Big-O, Really?

Big-O notation describes the shape of an algorithm's cost as its input grows — deliberately throwing away constant factors and lower-order terms to make that shape comparable across completely different algorithms. That's exactly why it's useful, and exactly why it's easy to misjudge in practice: "O(n²) is worse than O(n log n)" is true, but says nothing about how much worse, or at what size of n it starts to matter. This page puts real numbers behind the shapes. Drag n up by orders of magnitude and watch what each class actually costs, both in raw operation counts and — assuming a machine doing a billion operations a second, a reasonable modern ballpark — in wall-clock time.

Try it: growth by the numbers

Move the slider to change n from ten to a billion. Every row recomputes live: the bar is each class's operation count on a log scale (linear would make everything except O(n³) vanish), and the right-hand figure is that same operation count converted into time at one billion operations per second.

The wall: O(2ⁿ) and O(n!)

Every class above stays within reach of each other even at n = 1,000,000,000 — polynomial growth is dramatic, but not catastrophic. Exponential and factorial growth are a different kind of thing entirely: they don't slow down, they hit a wall, and the wall shows up at surprisingly small n. Try dragging this one from 1 up toward 100 and watch how fast both figures below stop meaning anything on a human timescale.

The age of the universe is about 13.8 billion years — once a figure below passes that, the exact number stops being meaningful and the point is just "incomprehensibly large."

Reference table

The same numbers as the slider above, pinned at three landmark sizes, for a quick lookup without touching anything:

classn = 10n = 1,000n = 1,000,000

See it on this site

Each row above is a real cost class, not just a textbook shape — here's one entry from this site landing on each one, checked against that page's own Complexity section rather than assumed:

For how a whole category's worth of algorithms stack up against each other rather than one class at a time, see the site's other guides — Choosing a Comparison Sort and Choosing a Search Algorithm both include a live race of their own.