benchmark
A repeatable measurement of how long code takes, or how much it uses, under a fixed workload, or more broadly a standard point of comparison such as an industry average.
In more detail
A fair benchmark runs the same input on each candidate, repeats enough times to smooth out noise, and compares against a baseline. The workload decides which option wins, so benchmark the case you actually have. Published benchmarks collected from other organisations predict little about your own service, so the most useful comparison is often a system against its own past.
Examples
The course benchmarks list against deque for front insertion and index access.The lessons benchmark libuv thread pool sizes and Buffer.alloc() against Buffer.allocUnsafe(); warming up lets V8's JIT optimise the code first.Related terms
- time.perf_counter — A Python function that returns a high-resolution clock reading in seconds, used to time short pieces of code.
- ratio test — An experimental check of a growth claim: divide the measured cost by the claimed function, such as n log n, and see whether the result stays roughly constant as n grows.
- baseline — A reference measurement that later measurements are compared against.
- DORA metrics — Five measures of software delivery from the DORA research: change lead time, deployment frequency, failed deployment recovery time, change fail rate and deployment rework rate.
- Stopwatch — A .NET class that measures elapsed time accurately, used to time a piece of code.
- profiler — A tool that records where a running program spends its time or allocates memory.
- throughput — How much work a system completes per unit of time, such as requests per second.
- latency — The time between asking for something and getting the answer back.
- performance.now() — A function that returns a high-resolution timestamp in milliseconds, with fractions, for measuring how long something takes.
Taught in
- Vector Indexes And Databases — AI Engineering: LLM Apps, RAG & Agents
- Recognising The Common Growth Rates — Algorithms & Data Structures for Working Engineers
- Stacks And Queues: Last In Or First In — Algorithms & Data Structures for Working Engineers
- Choosing The Right Sequence — Algorithms & Data Structures for Working Engineers
- The Pitfalls Of Measurement — DevOps & Site Reliability Engineering
- Async and Await: Managing Concurrency — Modern .NET Core, C# & Enterprise Microservices
- libuv Architecture: Event Demultiplexer & Thread Pool — Node.js Internals & Backend Services
- Buffer Fundamentals: Slab Allocator & V8 Memory — Node.js Internals & Backend Services
References
- Python timeit: measure execution time
- Python time.perf_counter
- DORA's software delivery performance metrics
- BenchmarkDotNet
- Node.js: Performance measurement APIs