1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
# Comparing benchmarks for regression
The following commands are tested with `cabal` version 3.0.
Run the benchmarks for the baseline code i.e. without the changes:
```
# Remove any old benchmark results file first
$ rm results.csv
$ cabal run bench -- --csvraw=results.csv --quick
```
It will collect the benchmark results in `results.csv` file.
Now repeat the above step for the new code i.e. with the changes.
It will append the new benchmarks results to the existing `results.csv` file.
If you want more accurate benchmark results remove the `--quick` flag.
To generate a benchmark comparison between old and new changes from the
benchmark results in `results.csv` file:
```
# [NOTE] The path "results.csv" is harcoded in the chart executable.
$ cabal run chart --flag bench-show
```
# Comparing with ICU (text-icu package)
Install the icu library:
```
# On Mac OS using MacPorts
$ sudo port install icu
# On Mac OS using brew
$ brew install icu4c
# On Debian Linux based distributions (the library version suffix may differ)
$ sudo apt-get install libicu65
```
If cabal cannot automatically find the icu library (e.g. when installed
via macports install) then use explicit `LIBRARY_PATH` to tell it where
the library is:
```
$ export LIBRARY_PATH=/usr/lib/:/opt/local/lib
# Alternatively, pass the lib and include path as follows
$ cabal bench --extra-lib-dirs=/usr/local/opt/icu4c/lib --extra-include-dirs=/usr/local/opt/icu4c/include
```
Remove any old `results.csv` and run benchmarks with `has-icu` flag enabled:
```
$ rm results.csv
$ cabal run bench --flag has-icu -- --csvraw=results.csv --quick
```
The following command will now show the comparison between `text-icu` and
`unicode-transforms`:
```
$ cabal run chart --flag bench-show
```
|