Computers are fast


Let’s find out how well you know computers!

All of these programs have a variable N in them. Your mission: guess how big N must get before the program takes 1 second to run.

You don’t need to guess exactly. Just try to guess the right order of magnitude! The options are all between one (10^0) and ten billion (10^10).

But first, some introductory points

  • If the answer is 38,400, both 10,000 and 100,000 are considered correct answers. The goal is to not be wrong by more than 10x, one order of magnitude 🤓.
  • We know computers have different disk & network & CPU speeds! We’re trying to understand the difference between code that can run ten times a second (10 Hz) and 100,000 times a second (100 KHz). A newer computer won’t make any of the benchmark code run 1000x faster.
    • That said, the results are from running on an 2023 Mac M2 Max with Python 3.11.7 and rustc 1.78.0 (9b00956e5 2024-04-29).
  • The Rust code was compiled with --release, of course.

Good luck! The first time I tried the original quiz (2014) I did decently but got a handful wrong. Each surprise is an invitation to question assumptions, and learn something new!

Rust
Python
Score: 0/0
Unanswered: 0

The code for these benchmarks is at github.com/thundergolfer/uni/tree/main/performance/computers-are-fast


If you want to improve your performance estimation skills I'd recommend checking out teachyourselfcs.com and sirupsen/napkin-math.

Want to get blog posts over email?

Enter your email address and get notified when there's a new post!