Charts from a small file

TOML or JSON in, dark PNG charts out, 5 to 7 ms a chart.

What it does

You write the numbers in a small JSON or TOML file, and pcmp draws them as dark, crisp charts in a hand-drawn pixel font: two or more parties side by side on one axis, how many times faster or slower one is than another, or plain bars.

Every chart shares one dark look, 1080 px wide, so charts from different runs and projects sit side by side; the party colours are yours to pick.

There is no plotting library: the canvas, the 5x7 pixel font and the PNG writer are a few hundred lines of Rust, so a chart is drawn the same, pixel for pixel, on every machine.

  • Paired bars

    Every party's value on one shared linear axis from zero, the value beside each bar, and per row how many times faster or slower the first party is than the one it is compared with. Rows fall under group headings, and a row can carry a mark such as * or † that a note explains.

  • Three or more parties

    Up to 12 parties on the same axis. versus names the one the first party's tags compare with, and better = "lower" turns the axis for times and latencies.

  • Balanced ratios

    1× in the middle, slower to the left and faster to the right on a symmetric log scale, so 3× slower is as long as 3× faster. pcmp draws it next to the paired bars for any data with two or more parties.

  • Single bars, your colours

    One party's values when there is nothing to compare; --kind bars with several parties draws one chart per party. A party's colour is any #RRGGBB or one of the chart's roles, and the legend and the bars follow it.

Measured

start to PNG on disk, a new process per chart, median of 50
5.5–7.1 ms
How it was measured
faster than matplotlib 3.11 drawing the same data
63×–77×
How it was measured
peak memory; matplotlib took 82.5 MB
12.9 MB
How it was measured
one binary, Linux x86_64, stripped: no Python, no system fonts
1.2 MB
README, at a glance
direct, clap for the command line among them; 27 crates for the library without clap
5
README, at a glance

How to use it

  1. Save the numbers as demo.toml.

    title = "PARSE SPEED"
    unit = "MEGABYTES PER SECOND"
    better = "higher"
    suffix = " MB/S"
    parties = [{ name = "PARSER V2" }, { name = "PARSER V1" }]
    rows = [
      { label = "CONFIG FILES", values = [612, 240] },
      { label = "LOG LINES", values = [455, 420] },
      { label = "DATA DUMPS", values = [1210, 388] },
    ]
  2. Draw them. A JSON file with the same keys works the same.

    pcmp demo.toml --out charts
  3. --kind all, the default, draws single bars for one party, and the paired and ratio charts for two or more.

    pcmp <DATA> [--out DIR] [--kind all|paired|ratio|bars]
  4. From Rust, the same charts with no command line: default-features = false leaves out clap.

    pito-compare = { git = "https://github.com/gmrdad82/pito-compare", tag = "v1.1.2", default-features = false }

Read it. Run it. It's MIT.

The code is MIT licensed, © Catalin Ilinca: read it, fork it, ship it in your own work. Its name and logos, and PITO MD's, are © Catalin Ilinca, all rights reserved, and are not covered by the MIT licence.