liveBook · Manning

Benchmark

As explained in Learn Haskell by Example

Benchmarking is the systematic measurement of program performance under specified conditions.

Benchmarking measures program performance under specified conditions. In parallel image processing, it verifies whether changing spark and chunk parameters actually improves execution time. section 13.4.3

Use benchmarking to tune parallel workloads by:

  • Adjusting chunk sizes and the number of sparks. section 13.4.3
  • Checking whether spark-management and garbage-collection costs outweigh parallel work. section 13.4.3
  • Comparing execution time and spark statistics before and after a change. section 13.4.3

Chunked image mapping

A faulty strategy created 1,318,768 sparks, with 1,210,301 overflowing, and took about 31 seconds. Chunking the vector produced 1,001 converted sparks and reduced execution time to about 8 seconds. section 13.4.3

SPARKS: 1001 (1001 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)

  INIT    time    0.000s  (  0.004s elapsed)
  MUT     time   27.682s  (  5.502s elapsed)
  GC      time    3.085s  (  2.180s elapsed)
  EXIT    time    0.000s  (  0.000s elapsed)
  Total   time   30.767s  (  7.686s elapsed)

Inspect runtime statistics showing converted sparks, overflowed sparks, CPU time, garbage-collection time, and elapsed time after chunking. section 13.4.3

How Learn Haskell by Example covers it

How deep it goes
Explains comparative timing and spark statistics, but leaves benchmarking as programmer-guided parameter tweaking.
Examples
Compares faulty and chunked vector strategies using spark counts and image-processing execution times.
What you can do after
Diagnose parallel performance and tune chunk parameters using execution times and runtime spark statistics.
How it connects
Connects parallelism with sparks, chunking, execution contexts, and garbage collection.

Also explained in

Compare how 23 books explain benchmark →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Haskell by Example. The section links point to the parts of the book it draws on.