A novel performance estimation quiz is putting developers' intuition about computational efficiency to the test. Created by software engineer Jonathon Belotti (thundergolfer), the interactive challenge presents code snippets in both Rust and Python containing a variable N. Participants must estimate the order of magnitude at which N causes the program to take approximately one second to execute—with answers considered correct within a factor of 10.

# Python example (simplified representation)
import time

def python_operation(N):
    result = 0
    for i in range(N):
        result += i
    return result

start = time.time()
python_operation(N)
end = time.time()
print(f"Time: {end - start} seconds")
// Rust example (simplified representation)
use std::time::Instant;

fn rust_operation(n: usize) -> usize {
    (0..n).sum()
}

fn main() {
    let now = Instant::now();
    rust_operation(N);
    let elapsed = now.elapsed();
    println!("Time: {:?}", elapsed);
}

The quiz emphasizes understanding orders of magnitude—whether code runs at 10 Hz or 100,000 Hz—rather than exact timings. Benchmarks run on a 2023 MacBook Pro M2 Max (Python 3.11.7, Rust 1.78.0 compiled with --release) reveal significant disparities:

  1. Language Performance Chasms: Simple operations might differ by 10-100x between equivalent Rust and Python implementations due to Python's interpreter overhead versus Rust's native compilation
  2. Hidden Bottlenecks: Operations appearing O(N) may exhibit worse practical scaling due to memory hierarchy effects or interpreter internals
  3. Modern Hardware Limits: While acknowledging hardware variations, the creator notes newer systems won't produce 1000x speedups for these tests, keeping focus on algorithmic intuition

"Each surprise is an invitation to question assumptions, and learn something new," Belotti notes, referencing his own imperfect initial attempts at similar quizzes. The exercise targets a critical developer skill: predicting real-world performance beyond Big O notation. Results often reveal how abstraction layers in high-level languages introduce unexpected costs.

The open-source benchmark code allows verification and extension, while recommendations for deeper study include Teach Yourself CS and the concept of napkin math. For engineers building latency-sensitive systems, calibrating this intuition isn't academic—it's essential for anticipating production bottlenecks before they trigger alerts.

Source: thundergolfer.com/computers-are-fast