01 July 2020

Frames

System: Slackware Linux (version 14.2)
CPUs: Intel(R) Atom(TM) CPU N270 @1.60GHz
Deps: ghc-8.6.5-i586-1_SBo.tgz,
llvm-6.0.1-i586-1_slack14.2.txz

Installation of A. Cowley's Frames package.

bash-4.3$ export PATH=~/.cabal/bin:${PATH}
bash-4.3$ cabal --version
cabal-install version 3.0.0.0
compiled using version 3.0.0.0 of the Cabal library
bash-4.3$ cabal v2-update
Downloading the latest package list from hackage.haskell.org
bash-4.3$ cabal v2-install --package-env comptour --lib Frames

...

bash-4.3$

In the below /tmp/bench is a modified copy of ~/.ghc/i386-linux-8.6.5/environments/comptour.

bash-4.3$ cd /tmp && tail bench -n 6
package-id text-1.2.3.1
package-id Frames-0.7.0-cb18728a893703a706e582444e8ade37572a14c71f67528f1288319473ec9b78
package-id vinyl-0.13.0-51517a9e2b710597162611778afc79126e9965c14836820ad0839d675d3332eb
package-id foldl-1.4.7-ce870291f10439f006a59811f03fed1f6ea958681a942c8eea5a4db8ffbaec56
package-id pipes-4.3.13-372a2fbe01116ab6719dfe177eb45f239915c03ab712b1cb94556bf77f7c25a9
package-id criterion-1.5.6.2-27cbcb22800b081ba75e954021db5033d049126da64c5f1479722680fe81c74e
bash-4.3$ tar xf ~/.cabal/packages/hackage.haskell.org/Frames/0.7.0/Frames-0.7.0.tar.gz
bash-4.3$ cd Frames-0.7.0
bash-4.3$ export GHC_ENVIRONMENT=/tmp/bench
bash-4.3$ ghc -O2 benchmarks/InsuranceBench.hs
Loaded package environment from /tmp/bench
Loaded package environment from /tmp/bench
[1 of 1] Compiling Main             ( benchmarks/InsuranceBench.hs, benchmarks/InsuranceBench.o )
Linking benchmarks/InsuranceBench ...
bash-4.3$ ghc -O2 benchmarks/JoinsBench.hs
Loaded package environment from /tmp/bench
Loaded package environment from /tmp/bench
[1 of 1] Compiling Main             ( benchmarks/JoinsBench.hs, benchmarks/JoinsBench.o )
Linking benchmarks/JoinsBench ...
bash-4.3$

The output of the two compiled executables.

bash-4.3$ benchmarks/InsuranceBench
benchmarking pipes
time                 5.654 s    (3.951 s .. 6.945 s)
                     0.990 R²   (0.964 R² .. 1.000 R²)
mean                 6.041 s    (5.757 s .. 6.257 s)
std dev              276.0 ms   (154.0 ms .. 335.6 ms)
variance introduced by outliers: 19% (moderately inflated)

benchmarking pipes in-core
time                 4.684 s    (4.558 s .. 4.761 s)
                     1.000 R²   (1.000 R² .. 1.000 R²)
mean                 4.689 s    (4.656 s .. 4.722 s)
std dev              36.10 ms   (3.144 ms .. 50.90 ms)
variance introduced by outliers: 19% (moderately inflated)

benchmarking pipes in-core subset
time                 3.200 s    (3.179 s .. 3.241 s)
                     1.000 R²   (1.000 R² .. 1.000 R²)
mean                 3.188 s    (3.170 s .. 3.198 s)
std dev              17.37 ms   (2.586 ms .. 22.37 ms)
variance introduced by outliers: 19% (moderately inflated)

benchmarking pipes AoS subset
time                 3.189 s    (3.014 s .. 3.313 s)
                     1.000 R²   (0.999 R² .. NaN R²)
mean                 3.238 s    (3.207 s .. 3.269 s)
std dev              39.33 ms   (17.35 ms .. 51.88 ms)
variance introduced by outliers: 19% (moderately inflated)

bash-4.3$ benchmarks/JoinsBench
benchmarking inner1a
time                 2.733 s    (2.061 s .. 3.772 s)
                     0.980 R²   (0.972 R² .. 1.000 R²)
mean                 2.377 s    (2.242 s .. 2.568 s)
std dev              198.1 ms   (41.82 ms .. 262.2 ms)
variance introduced by outliers: 21% (moderately inflated)

benchmarking inner1b
time                 1.038 s    (901.0 ms .. 1.190 s)
                     0.997 R²   (0.991 R² .. 1.000 R²)
mean                 1.021 s    (997.4 ms .. 1.040 s)
std dev              23.59 ms   (10.21 ms .. 28.48 ms)
variance introduced by outliers: 19% (moderately inflated)

benchmarking inner2
time                 1.472 s    (1.326 s .. 1.620 s)
                     0.999 R²   (0.995 R² .. 1.000 R²)
mean                 1.480 s    (1.444 s .. 1.494 s)
std dev              25.28 ms   (7.468 ms .. 34.06 ms)
variance introduced by outliers: 19% (moderately inflated)

benchmarking outer2
time                 1.728 s    (1.529 s .. 1.988 s)
                     0.997 R²   (0.992 R² .. 1.000 R²)
mean                 1.632 s    (1.576 s .. 1.676 s)
std dev              58.89 ms   (27.31 ms .. 79.87 ms)
variance introduced by outliers: 19% (moderately inflated)

benchmarking left2
time                 1.614 s    (1.320 s .. 1.885 s)
                     0.996 R²   (0.985 R² .. 1.000 R²)
mean                 1.662 s    (1.625 s .. 1.730 s)
std dev              65.91 ms   (6.551 ms .. 84.45 ms)
variance introduced by outliers: 19% (moderately inflated)

benchmarking left2
time                 1.417 s    (1.035 s .. 1.808 s)
                     0.990 R²   (0.964 R² .. 1.000 R²)
mean                 1.479 s    (1.368 s .. 1.521 s)
std dev              78.08 ms   (964.2 μs .. 96.10 ms)
variance introduced by outliers: 19% (moderately inflated)

bash-4.3$

A line needed to be added to /usr/lib/ghc-8.6.5/llvm-targets for BenchDemo.hs to compile.

,("i686-unknown-linux", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))

bash-4.3$ ghc -O2 -fllvm benchmarks/BenchDemo.hs
Loaded package environment from /tmp/bench
Loaded package environment from /tmp/bench
[1 of 1] Compiling Main             ( benchmarks/BenchDemo.hs, benchmarks/BenchDemo.o )
Linking benchmarks/BenchDemo ...
bash-4.3$

The timed output of the compiled executable.

bash-4.3$ /usr/bin/time benchmarks/BenchDemo
28.087046540127773
-81.90380988232442
2.74user 0.05system 0:02.87elapsed 97%CPU (0avgtext+0avgdata 20240maxresident)k
8344inputs+0outputs (2major+473minor)pagefaults 0swaps
bash-4.3$

Optionally install a local pandas.

bash-4.3$ ~/.local/bin/pip --version
pip 20.2.1 from /home/eric/.local/lib/python3.7/site-packages/pip (python 3.7)
bash-4.3$ export PATH=~/.local/bin:${PATH}
bash-4.3$ pip install pandas --user

...

bash-4.3$

The timed output of the Python scripts.

bash-4.3$ /usr/bin/time python3 benchmarks/panda.py
28.087476512229077
-81.90356506136375
3.53user 0.58system 0:09.05elapsed 45%CPU (0avgtext+0avgdata 232240maxresident)k
67128inputs+0outputs (177major+11747minor)pagefaults 0swaps
bash-4.3$ /usr/bin/time python3 benchmarks/pandas_joins.py
36634
67
67
36634
36634
67
4.07user 0.72system 0:10.84elapsed 44%CPU (0avgtext+0avgdata 204432maxresident)k
76040inputs+0outputs (195major+23387minor)pagefaults 0swaps
bash-4.3$

The discrepancy in the BenchDemo and panda.py output has been addressed in the 0.7.2 version.

In GHC to access Frames.

export GHC_ENVIRONMENT=~/.ghc/i386-linux-8.6.5/environments/comptour

In GHCi to access Frames, if GHC_ENVIRONMENT is not set.

ghci -package-env comptour

If you're using a Cabal script you can set the Frames version number.

ghc-8.6.5 (build script)
llvm-6.0.1 (32-bit pre-compiled)

[   ] [   ]


The Swedish word comptour is a historic alternate spelling of kontor.

bash-4.3$ diff ~/.ghc/i386-linux-8.6.5/environments/default \
> ~/.ghc/i386-linux-8.6.5/environments/comptour
27a28,29
> package-id Frames-0.7.0-cb18728a893703a706e582444e8ade37572a14c71f67528f1288319473ec9b78
> package-id foldl-1.4.7-ce870291f10439f006a59811f03fed1f6ea958681a942c8eea5a4db8ffbaec56
bash-4.3$