Add plotting example to README

This commit is contained in:
Bodigrim 2021-03-28 00:00:16 +00:00
parent 7135e79619
commit 4569c5312f
4 changed files with 79 additions and 1 deletions

View File

@ -20,6 +20,7 @@ and between benchmarks.
- [Isolating interfering benchmarks](#isolating-interfering-benchmarks)
- [Comparison against baseline](#comparison-against-baseline)
- [Comparison between benchmarks](#comparison-between-benchmarks)
- [Plotting results](#plotting-results)
- [Command-line options](#command-line-options)
<!-- /MarkdownTOC -->
@ -471,6 +472,15 @@ bcompare "$NF == \"tenth\" && $(NF-1) == \"fibonacci numbers\""
is a more robust choice of
an [`awk` pattern](https://github.com/feuerbach/tasty#patterns) here.
## Plotting results
Users can dump results into CSV with `--csv FILE`
and plot them using `gnuplot` or other software. But for convenience
there is also a built-in quick-and-dirty SVG plotting feature,
which can be invoked by passing `--svg FILE`. Here is a sample of its output:
![Plotting](./example.svg)
## Command-line options
Use `--help` to list command-line options.
@ -510,3 +520,7 @@ Use `--help` to list command-line options.
Upper bounds of acceptable slow down / speed up in percents. If a benchmark is unacceptably slower / faster than baseline (see `--baseline`),
it will be reported as failed. Can be used in conjunction with
a standard `tasty` option `--hide-successes` to show only problematic benchmarks.
* `--svg`
File to plot results in SVG format.

View File

@ -423,6 +423,15 @@ Locating a baseline benchmark in larger suites could get tricky;
is a more robust choice of
an <https://github.com/feuerbach/tasty#patterns awk pattern> here.
=== Plotting results
Users can dump results into CSV with @--csv@ @FILE@ and plot them using
@gnuplot@ or other software. But for convenience there is also a
built-in quick-and-dirty SVG plotting feature, which can be invoked by
passing @--svg@ @FILE@. Here is a sample of its output:
![Plotting](example.svg)
=== Command-line options
Use @--help@ to list command-line options.
@ -468,6 +477,10 @@ Use @--help@ to list command-line options.
conjunction with a standard @tasty@ option @--hide-successes@ to
show only problematic benchmarks.
[@--svg@]:
File to plot results in SVG format.
-}
{-# LANGUAGE CPP #-}

49
example.svg Normal file
View File

@ -0,0 +1,49 @@
<svg xmlns="http://www.w3.org/2000/svg" height="227" width="960.0" font-size="16" font-family="sans-serif" stroke-width="2">
<g transform="translate(10.0 0)">
<g fill="hsl(0, 100%, 40%)">
<text y="22">Inversion.Data.Mod</text>
<text y="22" x="283.118455709073" text-anchor="end">353 ms</text>
</g>
<g>
<title>353 ms ± 47 ms</title>
<rect y="28" rx="5" height="22" width="283.118455709073" fill="hsl(0, 100%, 80%)" stroke="hsl(0, 100%, 55%)" />
<g stroke="hsl(0, 100%, 40%)"><line x1="245.25631736668015" x2="320.9805940514658" y1="39" y2="39" />
<line x1="245.25631736668015" x2="245.25631736668015" y1="33" y2="45" />
<line x1="320.9805940514658" x2="320.9805940514658" y1="33" y2="45" />
</g>
</g>
<text fill="hsl(90, 100%, 40%)" y="77">Inversion.Data.Mod.Word 294 ms</text>
<g>
<title>294 ms ± 43 ms</title>
<rect y="83" rx="5" height="22" width="235.65287325623" fill="hsl(90, 100%, 80%)" stroke="hsl(90, 100%, 55%)" />
<g stroke="hsl(90, 100%, 40%)"><line x1="201.23554942411812" x2="270.0701970883419" y1="94" y2="94" />
<line x1="201.23554942411812" x2="201.23554942411812" y1="88" y2="100" />
<line x1="270.0701970883419" x2="270.0701970883419" y1="88" y2="100" />
</g>
</g>
<g fill="hsl(180, 100%, 40%)">
<text y="132">Inversion.finite-field</text>
<text y="132" x="821.8298170179202" text-anchor="end">1.03 s</text>
</g>
<g>
<title>1.03 s ± 147 ms</title>
<rect y="138" rx="5" height="22" width="821.8298170179202" fill="hsl(180, 100%, 80%)" stroke="hsl(180, 100%, 55%)" />
<g stroke="hsl(180, 100%, 40%)"><line x1="703.6596340358403" x2="940.0" y1="149" y2="149" />
<line x1="703.6596340358403" x2="703.6596340358403" y1="143" y2="155" />
<line x1="940.0" x2="940.0" y1="143" y2="155" />
</g>
</g>
<g fill="hsl(270, 100%, 40%)">
<text y="187">Inversion.modular-arithmetic</text>
<text y="187" x="717.8860415010972" text-anchor="end">896 ms</text>
</g>
<g>
<title>896 ms ± 58 ms</title>
<rect y="193" rx="5" height="22" width="717.8860415010972" fill="hsl(270, 100%, 80%)" stroke="hsl(270, 100%, 55%)" />
<g stroke="hsl(270, 100%, 40%)"><line x1="671.4753013587209" x2="764.2967816434735" y1="204" y2="204" />
<line x1="671.4753013587209" x2="671.4753013587209" y1="198" y2="210" />
<line x1="764.2967816434735" x2="764.2967816434735" y1="198" y2="210" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1,6 +1,6 @@
name: tasty-bench
version: 0.2.3
cabal-version: >=1.10
cabal-version: 1.18
build-type: Simple
license: MIT
license-file: LICENSE
@ -20,6 +20,8 @@ description:
extra-source-files:
changelog.md
README.md
extra-doc-files:
example.svg
tested-with: GHC==9.0.1, GHC==8.10.4, GHC==8.8.4, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2, GHC==7.0.4