liveBook · Manning

Benchmark

As explained in Fast Python: High performance techniques for large datasets

A benchmark is a defined task, dataset, workload, procedure, or reference measure used to assess or compare performance or capability under specified criteria or conditions.

A benchmark measures performance under a defined workload and set of conditions. Test the code and data patterns that matter to your use case: implementations can perform differently, so a published result may not predict your own. section 4.3.2 section 6.2.1

Make comparisons interpretable by matching the benchmark to the work being measured:

  • Use varied, representative inputs. Zero-filled, tiled, and random arrays produce very different compression behavior. section 6.2.1
  • Measure relevant costs separately. Compression comparisons include both elapsed time and disk space; disk-write tests flush operating-system buffers before timing. section 6.2.1

Comparing array writes

For zero-filled and tiled arrays, Blosc writes took about 0.53 seconds versus 7.49 seconds for NumPy; for random data, NumPy was slightly faster. Compressed tiled and zero arrays also occupied far less disk space, while random data did not shrink. section 6.2.1

os.system("sync")
%time write_numpy(zero_arr, "zero")
%time write_blosc(zero_arr, "zero")
%time write_numpy(rep_tile_arr, "rep_tile")
%time write_blosc(rep_tile_arr, "rep_tile")
%time write_numpy(random_arr, "random")
%time write_blosc(random_arr, "random")

View the timing calls used to compare NumPy and Blosc writes across the three array types. section 6.2.1

How Fast Python: High performance techniques for large datasets covers it

How deep it goes
Builds worked comparisons with varied arrays, timed writes, and buffer flushing, but does not give a general benchmarking procedure.
Examples
Compares BLAS builds and times NumPy versus Blosc writes for zero, tiled, and random arrays.
What you can do after
Evaluate implementation trade-offs by benchmarking code-specific workloads and comparing time with disk-space use.
How it connects
Connects benchmarking with NumPy, BLAS, data compression, and disk I/O.

Also explained in

Compare how 23 books explain benchmark →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast Python: High performance techniques for large datasets. The section links point to the parts of the book it draws on.