Skip to content

Instantly share code, notes, and snippets.

@suuuehgi
Forked from Artefact2/00considerations.md
Created February 4, 2018 15:58
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suuuehgi/f38ad8d220d1e06e43d1c44efcd035a8 to your computer and use it in GitHub Desktop.
Save suuuehgi/f38ad8d220d1e06e43d1c44efcd035a8 to your computer and use it in GitHub Desktop.
Borg compression benchmark/comparison
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Considerations

  • Forked from Artefact2
  • Tests were run in single-user mode, one at a time.
  • Data was read from and written to tmpfs.
  • I did not have the dataset from Artefact2 for zstd
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Dataset 1: linux 4.13 mainline sources (many small files, good compressibility)

Benchmark date: 2017-09-09
Borg version: borg-linux64 1.1.0rc2
Python version: Python 3.6.2
Kernel version: Linux 4.12.8-2-ARCH
CPU model: AMD FX(tm)-8150 Eight-Core Processor

Borg init command: %s init --error -e repokey %s
Borg create command: %s create --error -C %s %s::foo %s
Dataset path: /tmp/borg-dataset (tmpfs)
Repository path: /tmp/borg-repo (tmpfs)

Averaging algos over 1 run(s)

           algo |    cputime |  reposize |   bytes/s | timeratio | compratio
----------------+------------+-----------+-----------+-----------+----------
           none |      31.10 |  792.654M |   25.487M |      1.00 |     1.000
            lz4 |      29.54 |  311.050M |   26.833M |      0.95 |     0.392
         zlib,0 |      33.00 |  793.244M |   24.020M |      1.06 |     1.001
         zlib,1 |      36.82 |  228.762M |   21.528M |      1.18 |     0.289
         zlib,2 |      37.74 |  221.245M |   21.003M |      1.21 |     0.279
         zlib,3 |      39.05 |  216.240M |   20.298M |      1.26 |     0.273
         zlib,4 |      41.51 |  205.451M |   19.095M |      1.33 |     0.259
         zlib,5 |      44.57 |  199.655M |   17.784M |      1.43 |     0.252
         zlib,6 |      50.48 |  197.501M |   15.702M |      1.62 |     0.249
         zlib,7 |      55.10 |  196.702M |   14.386M |      1.77 |     0.248
         zlib,8 |      66.13 |  196.170M |   11.986M |      2.13 |     0.247
         zlib,9 |      66.77 |  196.137M |   11.871M |      2.15 |     0.247
         lzma,0 |      79.57 |  201.884M | 9961.717K |      2.56 |     0.255
         lzma,1 |      96.85 |  195.178M | 8184.345K |      3.11 |     0.246
         lzma,2 |     114.55 |  192.754M | 6919.719K |      3.68 |     0.243
         lzma,3 |     154.87 |  191.959M | 5118.188K |      4.98 |     0.242
         lzma,4 |     307.70 |  189.075M | 2576.060K |      9.89 |     0.239
         lzma,5 |     487.64 |  185.676M | 1625.489K |     15.68 |     0.234
         lzma,6 |     543.37 |  184.078M | 1458.773K |     17.47 |     0.232
         lzma,7 |     764.68 |  184.058M | 1036.582K |     24.59 |     0.232
         lzma,8 |    1218.62 |  184.082M |  650.452K |     39.18 |     0.232
         lzma,9 |    1218.07 |  184.095M |  650.745K |     39.17 |     0.232
       auto,lz4 |      32.19 |  311.050M |   24.624M |      1.04 |     0.392
    auto,zlib,0 |      36.56 |  793.240M |   21.681M |      1.18 |     1.001
    auto,zlib,1 |      39.51 |  228.762M |   20.062M |      1.27 |     0.289
    auto,zlib,2 |      41.02 |  221.250M |   19.324M |      1.32 |     0.279
    auto,zlib,3 |      41.67 |  216.248M |   19.022M |      1.34 |     0.273
    auto,zlib,4 |      44.01 |  205.447M |   18.011M |      1.42 |     0.259
    auto,zlib,5 |      47.52 |  199.660M |   16.680M |      1.53 |     0.252
    auto,zlib,6 |      53.45 |  197.497M |   14.830M |      1.72 |     0.249
    auto,zlib,7 |      57.71 |  196.706M |   13.735M |      1.86 |     0.248
    auto,zlib,8 |      67.28 |  196.162M |   11.781M |      2.16 |     0.247
    auto,zlib,9 |      69.64 |  196.141M |   11.382M |      2.24 |     0.247
    auto,lzma,0 |      82.29 |  201.830M | 9632.444K |      2.65 |     0.255
    auto,lzma,1 |     100.03 |  195.105M | 7924.160K |      3.22 |     0.246
    auto,lzma,2 |     116.15 |  192.668M | 6824.397K |      3.73 |     0.243
    auto,lzma,3 |     159.19 |  192.012M | 4979.294K |      5.12 |     0.242
    auto,lzma,4 |     314.17 |  189.080M | 2523.009K |     10.10 |     0.239
    auto,lzma,5 |     486.67 |  185.709M | 1628.729K |     15.65 |     0.234
    auto,lzma,6 |     542.93 |  184.013M | 1459.955K |     17.46 |     0.232
    auto,lzma,7 |     763.56 |  184.054M | 1038.102K |     24.55 |     0.232
    auto,lzma,8 |    1207.50 |  184.029M |  656.442K |     38.83 |     0.232
    auto,lzma,9 |    1205.69 |  184.001M |  657.427K |     38.77 |     0.232
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Dataset 2: postgres dump (large text files, good compressibility)

Benchmark date: 2017-09-10
Borg version: borg-linux64 1.1.0rc2
Python version: Python 3.6.2
Kernel version: Linux 4.12.8-2-ARCH
CPU model: AMD FX(tm)-8150 Eight-Core Processor

Borg init command: %s init --error -e repokey %s
Borg create command: %s create --error -C %s %s::foo %s
Dataset path: /tmp/borg-dataset (tmpfs)
Repository path: /tmp/borg-repo (tmpfs)

Averaging algos over 1 run(s)

           algo |    cputime |  reposize |   bytes/s | timeratio | compratio
----------------+------------+-----------+-----------+-----------+----------
           none |      12.06 |  682.570M |   56.598M |      1.00 |     1.000
            lz4 |      10.04 |  222.540M |   67.985M |      0.83 |     0.326
         zlib,0 |      14.91 |  682.672M |   45.779M |      1.24 |     1.000
         zlib,1 |      15.61 |  154.948M |   43.726M |      1.29 |     0.227
         zlib,2 |      16.50 |  150.839M |   41.368M |      1.37 |     0.221
         zlib,3 |      18.30 |  147.550M |   37.299M |      1.52 |     0.216
         zlib,4 |      21.61 |  136.143M |   31.586M |      1.79 |     0.199
         zlib,5 |      25.56 |  128.610M |   26.705M |      2.12 |     0.188
         zlib,6 |      31.23 |  126.640M |   21.856M |      2.59 |     0.186
         zlib,7 |      36.63 |  125.997M |   18.634M |      3.04 |     0.185
         zlib,8 |      51.20 |  124.961M |   13.331M |      4.25 |     0.183
         zlib,9 |      53.49 |  124.903M |   12.761M |      4.44 |     0.183
         lzma,0 |      43.15 |  125.125M |   15.819M |      3.58 |     0.183
         lzma,1 |      47.43 |  115.737M |   14.391M |      3.93 |     0.170
         lzma,2 |      59.86 |  111.706M |   11.403M |      4.96 |     0.164
         lzma,3 |      77.78 |  109.818M | 8775.645K |      6.45 |     0.161
         lzma,4 |     129.02 |   98.345M | 5290.417K |     10.70 |     0.144
         lzma,5 |     174.62 |   94.564M | 3908.886K |     14.48 |     0.139
         lzma,6 |     320.48 |   89.686M | 2129.835K |     26.57 |     0.131
         lzma,7 |     322.40 |   89.711M | 2117.151K |     26.73 |     0.131
         lzma,8 |     326.85 |   89.489M | 2088.327K |     27.10 |     0.131
         lzma,9 |     329.77 |   89.518M | 2069.835K |     27.34 |     0.131
       auto,lz4 |      11.78 |  222.540M |   57.943M |      0.98 |     0.326
    auto,zlib,0 |      16.60 |  682.672M |   41.119M |      1.38 |     1.000
    auto,zlib,1 |      17.35 |  154.952M |   39.341M |      1.44 |     0.227
    auto,zlib,2 |      18.13 |  150.847M |   37.649M |      1.50 |     0.221
    auto,zlib,3 |      20.02 |  147.522M |   34.094M |      1.66 |     0.216
    auto,zlib,4 |      23.53 |  136.163M |   29.008M |      1.95 |     0.199
    auto,zlib,5 |      26.54 |  128.618M |   25.719M |      2.20 |     0.188
    auto,zlib,6 |      34.28 |  126.648M |   19.912M |      2.84 |     0.186
    auto,zlib,7 |      37.69 |  125.989M |   18.110M |      3.13 |     0.185
    auto,zlib,8 |      53.51 |  124.953M |   12.756M |      4.44 |     0.183
    auto,zlib,9 |      55.94 |  124.891M |   12.202M |      4.64 |     0.183
    auto,lzma,0 |      45.07 |  125.088M |   15.145M |      3.74 |     0.183
    auto,lzma,1 |      49.24 |  115.806M |   13.862M |      4.08 |     0.170
    auto,lzma,2 |      61.87 |  111.907M |   11.032M |      5.13 |     0.164
    auto,lzma,3 |      78.91 |  110.121M | 8649.977K |      6.54 |     0.161
    auto,lzma,4 |     135.67 |   97.944M | 5031.102K |     11.25 |     0.143
    auto,lzma,5 |     173.32 |   94.376M | 3938.205K |     14.37 |     0.138
    auto,lzma,6 |     321.33 |   89.723M | 2124.201K |     26.64 |     0.131
    auto,lzma,7 |     324.67 |   89.477M | 2102.349K |     26.92 |     0.131
    auto,lzma,8 |     325.54 |   89.559M | 2096.730K |     26.99 |     0.131
    auto,lzma,9 |     327.80 |   89.825M | 2082.274K |     27.18 |     0.132

Dataset 3: RAW photo collection (large files, poor compressibility)

Benchmark date: 2017-09-10
Borg version: borg-linux64 1.1.0rc2
Python version: Python 3.6.2
Kernel version: Linux 4.12.8-2-ARCH
CPU model: AMD FX(tm)-8150 Eight-Core Processor

Borg init command: %s init --error -e repokey %s
Borg create command: %s create --error -C %s %s::foo %s
Dataset path: /tmp/borg-dataset (tmpfs)
Repository path: /tmp/borg-repo (tmpfs)

Averaging algos over 1 run(s)

           algo |    cputime |  reposize |   bytes/s | timeratio | compratio
----------------+------------+-----------+-----------+-----------+----------
           none |      10.08 |  552.243M |   54.786M |      1.00 |     1.000
            lz4 |      10.51 |  553.198M |   52.545M |      1.04 |     1.002
         zlib,0 |      12.31 |  552.329M |   44.861M |      1.22 |     1.000
         zlib,1 |      31.31 |  541.327M |   17.638M |      3.11 |     0.980
         zlib,2 |      30.76 |  541.123M |   17.953M |      3.05 |     0.980
         zlib,3 |      32.22 |  541.028M |   17.140M |      3.20 |     0.980
         zlib,4 |      32.63 |  541.639M |   16.924M |      3.24 |     0.981
         zlib,5 |      33.09 |  541.610M |   16.689M |      3.28 |     0.981
         zlib,6 |      34.04 |  541.594M |   16.223M |      3.38 |     0.981
         zlib,7 |      32.58 |  541.594M |   16.950M |      3.23 |     0.981
         zlib,8 |      33.74 |  541.594M |   16.368M |      3.35 |     0.981
         zlib,9 |      32.60 |  541.598M |   16.940M |      3.23 |     0.981
         lzma,0 |     114.12 |  539.759M | 4839.144K |     11.32 |     0.977
         lzma,1 |     128.01 |  539.451M | 4314.062K |     12.70 |     0.977
         lzma,2 |     139.48 |  539.443M | 3959.300K |     13.84 |     0.977
         lzma,3 |     144.05 |  539.423M | 3833.691K |     14.29 |     0.977
         lzma,4 |     152.77 |  536.760M | 3614.866K |     15.16 |     0.972
         lzma,5 |     150.73 |  536.711M | 3663.790K |     14.95 |     0.972
         lzma,6 |     150.52 |  536.781M | 3668.902K |     14.93 |     0.972
         lzma,7 |     148.66 |  536.748M | 3714.806K |     14.75 |     0.972
         lzma,8 |     149.84 |  536.805M | 3685.552K |     14.87 |     0.972
         lzma,9 |     149.07 |  536.736M | 3704.589K |     14.79 |     0.972
       auto,lz4 |      10.69 |  551.404M |   51.660M |      1.06 |     0.998
    auto,zlib,0 |      10.99 |  552.255M |   50.250M |      1.09 |     1.000
    auto,zlib,1 |      13.00 |  546.533M |   42.480M |      1.29 |     0.990
    auto,zlib,2 |      13.37 |  545.362M |   41.305M |      1.33 |     0.988
    auto,zlib,3 |      13.57 |  545.980M |   40.696M |      1.35 |     0.989
    auto,zlib,4 |      14.26 |  545.980M |   38.727M |      1.41 |     0.989
    auto,zlib,5 |      15.30 |  544.649M |   36.094M |      1.52 |     0.986
    auto,zlib,6 |      13.90 |  546.619M |   39.730M |      1.38 |     0.990
    auto,zlib,7 |      14.00 |  546.296M |   39.446M |      1.39 |     0.989
    auto,zlib,8 |      13.67 |  546.947M |   40.398M |      1.36 |     0.990
    auto,zlib,9 |      14.01 |  546.161M |   39.418M |      1.39 |     0.989
    auto,lzma,0 |      21.26 |  544.084M |   25.976M |      2.11 |     0.985
    auto,lzma,1 |      23.84 |  544.461M |   23.165M |      2.37 |     0.986
    auto,lzma,2 |      24.53 |  544.211M |   22.513M |      2.43 |     0.985
    auto,lzma,3 |      25.64 |  544.330M |   21.538M |      2.54 |     0.986
    auto,lzma,4 |      31.46 |  542.163M |   17.554M |      3.12 |     0.982
    auto,lzma,5 |      28.74 |  542.806M |   19.215M |      2.85 |     0.983
    auto,lzma,6 |      27.20 |  543.543M |   20.303M |      2.70 |     0.984
    auto,lzma,7 |      25.30 |  544.756M |   21.828M |      2.51 |     0.986
    auto,lzma,8 |      26.69 |  543.953M |   20.691M |      2.65 |     0.985
    auto,lzma,9 |      27.53 |  542.675M |   20.060M |      2.73 |     0.983

Large Journal File (112 MB)

Benchmark date: 2018-04-09
Borg version: borg 1.1.5
Python version: Python 3.6.4
Kernel version: Linux 4.15.15-1-ARCH
CPU model: Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz

Borg init command: %s init --error -e repokey %s
Borg create command: %s create --error -C %s %s::foo %s
Dataset path: /tmp/borgdataset (tmpfs)
Repository path: /tmp/borg-repo (tmpfs)

Averaging algos over 1 run(s)

           algo |    cputime |  reposize |   bytes/s | timeratio | compratio
----------------+------------+-----------+-----------+-----------+----------
           none |       2.36 |  117.527M |   49.799M |      1.00 |     1.000
            lz4 |       1.90 |   22.360M |   61.856M |      0.81 |     0.190
         zlib,0 |       2.47 |  117.535M |   47.582M |      1.05 |     1.000
         zlib,1 |       2.63 |   14.262M |   44.687M |      1.11 |     0.121
         zlib,2 |       2.64 |   13.529M |   44.518M |      1.12 |     0.115
         zlib,3 |       3.34 |   13.464M |   35.188M |      1.42 |     0.115
         zlib,4 |       3.37 |   13.173M |   34.874M |      1.43 |     0.112
         zlib,5 |       3.96 |   13.017M |   29.678M |      1.68 |     0.111
         zlib,6 |       5.36 |   12.931M |   21.927M |      2.27 |     0.110
         zlib,7 |       6.82 |   12.902M |   17.233M |      2.89 |     0.110
         zlib,8 |      13.77 |   12.952M | 8534.969K |      5.83 |     0.110
         zlib,9 |      36.13 |   12.980M | 3252.879K |     15.31 |     0.110
         lzma,0 |       5.07 | 8687.616K |   23.181M |      2.15 |     0.074
         lzma,1 |       5.23 | 6987.776K |   22.472M |      2.22 |     0.059
         lzma,2 |       5.85 | 7282.688K |   20.090M |      2.48 |     0.062
         lzma,3 |       6.45 | 6795.264K |   18.221M |      2.73 |     0.058
         lzma,4 |      15.95 | 6250.496K | 7368.434K |      6.76 |     0.053
         lzma,5 |      20.91 | 6037.504K | 5620.589K |      8.86 |     0.051
         lzma,6 |      27.10 | 6057.984K | 4336.772K |     11.48 |     0.052
         lzma,7 |      29.24 | 6311.936K | 4019.375K |     12.39 |     0.054
         lzma,8 |      28.81 | 5947.392K | 4079.365K |     12.21 |     0.051
         lzma,9 |      29.36 | 5926.912K | 4002.947K |     12.44 |     0.050
         zstd,1 |       2.02 | 9875.456K |   58.181M |      0.86 |     0.084
         zstd,2 |       1.92 |   10.211M |   61.212M |      0.81 |     0.087
         zstd,3 |       2.00 | 8953.856K |   58.763M |      0.85 |     0.076
         zstd,4 |       2.11 | 8671.232K |   55.700M |      0.89 |     0.074
         zstd,5 |       2.42 | 9052.160K |   48.565M |      1.03 |     0.077
         zstd,6 |       2.79 | 9318.400K |   42.124M |      1.18 |     0.079
         zstd,7 |       2.71 | 7933.952K |   43.368M |      1.15 |     0.068
         zstd,8 |       3.00 | 7680.000K |   39.176M |      1.27 |     0.065
         zstd,9 |       3.04 | 7897.088K |   38.660M |      1.29 |     0.067
        zstd,10 |       3.70 | 8794.112K |   31.764M |      1.57 |     0.075
        zstd,11 |       3.52 | 7806.976K |   33.388M |      1.49 |     0.066
        zstd,12 |       3.83 | 7483.392K |   30.686M |      1.62 |     0.064
        zstd,13 |       5.74 | 7712.768K |   20.475M |      2.43 |     0.066
        zstd,14 |       7.16 | 7593.984K |   16.414M |      3.03 |     0.065
        zstd,15 |      12.23 | 7761.920K | 9609.691K |      5.18 |     0.066
        zstd,16 |      17.84 | 7499.776K | 6587.809K |      7.56 |     0.064
        zstd,17 |      19.10 | 7294.976K | 6153.221K |      8.09 |     0.062
        zstd,18 |      27.62 | 7258.112K | 4255.124K |     11.70 |     0.062
        zstd,19 |      31.60 | 7798.784K | 3719.193K |     13.39 |     0.066
        zstd,20 |      36.01 | 7868.416K | 3263.719K |     15.26 |     0.067
        zstd,21 |      33.29 | 7118.848K | 3530.385K |     14.11 |     0.061
        zstd,22 |      86.91 | 6742.016K | 1352.278K |     36.83 |     0.057
       auto,lz4 |       2.15 |   22.356M |   54.664M |      0.91 |     0.190
    auto,zlib,0 |       2.07 |   22.356M |   56.776M |      0.88 |     0.190
    auto,zlib,1 |       2.80 |   14.053M |   41.974M |      1.19 |     0.120
    auto,zlib,2 |       2.84 |   13.533M |   41.383M |      1.20 |     0.115
    auto,zlib,3 |       2.90 |   13.238M |   40.526M |      1.23 |     0.113
    auto,zlib,4 |       3.35 |   13.173M |   35.083M |      1.42 |     0.112
    auto,zlib,5 |       3.76 |   13.021M |   31.257M |      1.59 |     0.111
    auto,zlib,6 |       5.44 |   12.911M |   21.604M |      2.31 |     0.110
    auto,zlib,7 |       6.80 |   12.894M |   17.283M |      2.88 |     0.110
    auto,zlib,8 |      13.74 |   12.956M | 8553.604K |      5.82 |     0.110
    auto,zlib,9 |      36.80 |   12.984M | 3193.655K |     15.59 |     0.110
    auto,lzma,0 |       5.31 | 8761.344K |   22.133M |      2.25 |     0.075
    auto,lzma,1 |       5.84 | 7966.720K |   20.124M |      2.47 |     0.068
    auto,lzma,2 |       5.74 | 6750.208K |   20.475M |      2.43 |     0.057
    auto,lzma,3 |       6.83 | 7069.696K |   17.207M |      2.89 |     0.060
    auto,lzma,4 |      15.97 | 6316.032K | 7359.206K |      6.77 |     0.054
    auto,lzma,5 |      21.95 | 6008.832K | 5354.283K |      9.30 |     0.051
    auto,lzma,6 |      28.20 | 6234.112K | 4167.607K |     11.95 |     0.053
    auto,lzma,7 |      28.30 | 6021.120K | 4152.880K |     11.99 |     0.051
    auto,lzma,8 |      30.76 | 6230.016K | 3820.758K |     13.03 |     0.053
    auto,lzma,9 |      31.45 | 6348.800K | 3736.932K |     13.33 |     0.054
    auto,zstd,1 |       2.04 | 9900.032K |   57.611M |      0.86 |     0.084
    auto,zstd,2 |       2.11 |   10.191M |   55.700M |      0.89 |     0.087
    auto,zstd,3 |       2.09 | 8773.632K |   56.233M |      0.89 |     0.075
    auto,zstd,4 |       2.14 | 8724.480K |   54.919M |      0.91 |     0.074
    auto,zstd,5 |       2.52 | 8810.496K |   46.638M |      1.07 |     0.075
    auto,zstd,6 |       2.79 | 8052.736K |   42.124M |      1.18 |     0.069
    auto,zstd,7 |       2.91 | 7888.896K |   40.387M |      1.23 |     0.067
    auto,zstd,8 |       3.17 | 8015.872K |   37.075M |      1.34 |     0.068
    auto,zstd,9 |       3.19 | 7589.888K |   36.842M |      1.35 |     0.065
   auto,zstd,10 |       3.41 | 7569.408K |   34.465M |      1.44 |     0.064
   auto,zstd,11 |       3.77 | 8028.160K |   31.174M |      1.60 |     0.068
   auto,zstd,12 |       3.83 | 7512.064K |   30.686M |      1.62 |     0.064
   auto,zstd,13 |       5.88 | 7864.320K |   19.988M |      2.49 |     0.067
   auto,zstd,14 |       7.26 | 7614.464K |   16.188M |      3.08 |     0.065
   auto,zstd,15 |      11.96 | 7663.616K | 9826.632K |      5.07 |     0.065
   auto,zstd,16 |      22.26 | 7962.624K | 5279.718K |      9.43 |     0.068
   auto,zstd,17 |      19.19 | 7237.632K | 6124.363K |      8.13 |     0.062
   auto,zstd,18 |      27.37 | 7364.608K | 4293.990K |     11.60 |     0.063
   auto,zstd,19 |      32.82 | 7909.376K | 3580.942K |     13.91 |     0.067
   auto,zstd,20 |      36.20 | 7258.112K | 3246.589K |     15.34 |     0.062
   auto,zstd,21 |      35.74 | 7950.336K | 3288.375K |     15.14 |     0.068
   auto,zstd,22 |      86.46 | 6963.200K | 1359.316K |     36.64 |     0.059

Medium Sized PDFs (N = 74), Mean: 3.6 MB, Std: 8.2 MB

Benchmark date: 2018-04-09
Borg version: borg 1.1.5
Python version: Python 3.6.4
Kernel version: Linux 4.15.15-1-ARCH
CPU model: Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz

Borg init command: %s init --error -e repokey %s
Borg create command: %s create --error -C %s %s::foo %s
Dataset path: /tmp/borgdataset (tmpfs)
Repository path: /tmp/borg-repo (tmpfs)

Averaging algos over 1 run(s)

           algo |    cputime |  reposize |   bytes/s | timeratio | compratio
----------------+------------+-----------+-----------+-----------+----------
           none |       4.23 |  269.820M |   63.787M |      1.00 |     1.000
            lz4 |       4.49 |  265.060M |   60.094M |      1.06 |     0.982
         zlib,0 |       4.36 |  269.840M |   61.885M |      1.03 |     1.000
         zlib,1 |      13.83 |  262.844M |   19.510M |      3.27 |     0.974
         zlib,2 |      13.96 |  262.779M |   19.328M |      3.30 |     0.974
         zlib,3 |      13.99 |  262.746M |   19.287M |      3.31 |     0.974
         zlib,4 |      14.37 |  262.672M |   18.777M |      3.40 |     0.974
         zlib,5 |      14.67 |  262.636M |   18.393M |      3.47 |     0.973
         zlib,6 |      14.70 |  262.595M |   18.355M |      3.48 |     0.973
         zlib,7 |      14.60 |  262.590M |   18.481M |      3.45 |     0.973
         zlib,8 |      14.77 |  262.599M |   18.268M |      3.49 |     0.973
         zlib,9 |      14.83 |  262.578M |   18.194M |      3.51 |     0.973
         lzma,0 |      75.97 |  262.431M | 3551.663K |     17.96 |     0.973
         lzma,1 |     104.71 |  261.935M | 2576.830K |     24.75 |     0.971
         lzma,2 |     104.03 |  261.390M | 2593.673K |     24.59 |     0.969
         lzma,3 |      97.22 |  261.308M | 2775.353K |     22.98 |     0.968
         lzma,4 |      97.76 |  260.997M | 2760.023K |     23.11 |     0.967
         lzma,5 |      96.46 |  260.465M | 2797.220K |     22.80 |     0.965
         lzma,6 |      92.41 |  260.923M | 2919.812K |     21.85 |     0.967
         lzma,7 |      93.01 |  260.792M | 2900.977K |     21.99 |     0.967
         lzma,8 |      95.05 |  260.813M | 2838.715K |     22.47 |     0.967
         lzma,9 |      94.23 |  261.014M | 2863.418K |     22.28 |     0.967
         zstd,1 |       4.78 |  263.500M |   56.448M |      1.13 |     0.977
         zstd,2 |       4.87 |  263.369M |   55.404M |      1.15 |     0.976
         zstd,3 |       5.12 |  263.094M |   52.699M |      1.21 |     0.975
         zstd,4 |       5.32 |  262.828M |   50.718M |      1.26 |     0.974
         zstd,5 |      10.08 |  262.345M |   26.768M |      2.38 |     0.972
         zstd,6 |      12.17 |  261.976M |   22.171M |      2.88 |     0.971
         zstd,7 |      13.71 |  261.800M |   19.681M |      3.24 |     0.970
         zstd,8 |      14.42 |  262.119M |   18.712M |      3.41 |     0.971
         zstd,9 |      14.49 |  262.001M |   18.621M |      3.43 |     0.971
        zstd,10 |      14.06 |  261.976M |   19.191M |      3.32 |     0.971
        zstd,11 |      15.71 |  261.722M |   17.175M |      3.71 |     0.970
        zstd,12 |      14.52 |  261.865M |   18.583M |      3.43 |     0.971
        zstd,13 |      21.22 |  261.648M |   12.715M |      5.02 |     0.970
        zstd,14 |      21.70 |  261.825M |   12.434M |      5.13 |     0.970
        zstd,15 |      22.60 |  261.407M |   11.939M |      5.34 |     0.969
        zstd,16 |      34.25 |  261.710M | 7877.953K |      8.10 |     0.970
        zstd,17 |      36.28 |  261.763M | 7437.152K |      8.58 |     0.970
        zstd,18 |      44.19 |  261.157M | 6105.904K |     10.45 |     0.968
        zstd,19 |      45.87 |  261.542M | 5882.273K |     10.84 |     0.969
        zstd,20 |      41.59 |  261.566M | 6487.614K |      9.83 |     0.969
        zstd,21 |      42.27 |  261.419M | 6383.248K |      9.99 |     0.969
        zstd,22 |      43.17 |  261.497M | 6250.171K |     10.21 |     0.969
       auto,lz4 |       4.48 |  264.585M |   60.228M |      1.06 |     0.981
    auto,zlib,0 |       4.39 |  264.528M |   61.462M |      1.04 |     0.980
    auto,zlib,1 |       8.29 |  263.430M |   32.548M |      1.96 |     0.976
    auto,zlib,2 |       8.54 |  263.328M |   31.595M |      2.02 |     0.976
    auto,zlib,3 |       8.26 |  263.324M |   32.666M |      1.95 |     0.976
    auto,zlib,4 |       8.64 |  263.238M |   31.229M |      2.04 |     0.976
    auto,zlib,5 |       8.66 |  263.193M |   31.157M |      2.05 |     0.975
    auto,zlib,6 |       8.61 |  263.160M |   31.338M |      2.04 |     0.975
    auto,zlib,7 |       8.73 |  263.143M |   30.907M |      2.06 |     0.975
    auto,zlib,8 |       9.12 |  263.107M |   29.586M |      2.16 |     0.975
    auto,zlib,9 |       8.74 |  263.152M |   30.872M |      2.07 |     0.975
    auto,lzma,0 |      26.77 |  262.918M |   10.079M |      6.33 |     0.974
    auto,lzma,1 |      40.72 |  262.623M | 6626.225K |      9.63 |     0.973
    auto,lzma,2 |      42.34 |  262.758M | 6372.694K |     10.01 |     0.974
    auto,lzma,3 |      39.33 |  262.550M | 6860.409K |      9.30 |     0.973
    auto,lzma,4 |      43.29 |  262.230M | 6232.846K |     10.23 |     0.972
    auto,lzma,5 |      39.78 |  262.377M | 6782.803K |      9.40 |     0.972
    auto,lzma,6 |      42.14 |  262.103M | 6402.940K |      9.96 |     0.971
    auto,lzma,7 |      40.94 |  262.463M | 6590.618K |      9.68 |     0.973
    auto,lzma,8 |      42.23 |  262.279M | 6389.294K |      9.98 |     0.972
    auto,lzma,9 |      42.08 |  262.349M | 6412.069K |      9.95 |     0.972
    auto,zstd,1 |       4.72 |  263.541M |   57.165M |      1.12 |     0.977
    auto,zstd,2 |       4.73 |  263.574M |   57.044M |      1.12 |     0.977
    auto,zstd,3 |       4.79 |  263.348M |   56.330M |      1.13 |     0.976
    auto,zstd,4 |       5.08 |  263.049M |   53.114M |      1.20 |     0.975
    auto,zstd,5 |       6.11 |  262.885M |   44.160M |      1.44 |     0.974
    auto,zstd,6 |       6.74 |  262.816M |   40.033M |      1.59 |     0.974
    auto,zstd,7 |       7.38 |  262.971M |   36.561M |      1.74 |     0.975
    auto,zstd,8 |       7.70 |  262.881M |   35.042M |      1.82 |     0.974
    auto,zstd,9 |       7.90 |  263.098M |   34.154M |      1.87 |     0.975
   auto,zstd,10 |       8.29 |  262.689M |   32.548M |      1.96 |     0.974
   auto,zstd,11 |       8.15 |  262.795M |   33.107M |      1.93 |     0.974
   auto,zstd,12 |       8.42 |  262.816M |   32.045M |      1.99 |     0.974
   auto,zstd,13 |       9.68 |  263.004M |   27.874M |      2.29 |     0.975
   auto,zstd,14 |      10.63 |  262.795M |   25.383M |      2.51 |     0.974
   auto,zstd,15 |      10.90 |  262.906M |   24.754M |      2.58 |     0.974
   auto,zstd,16 |      17.77 |  262.693M |   15.184M |      4.20 |     0.974
   auto,zstd,17 |      18.95 |  262.529M |   14.239M |      4.48 |     0.973
   auto,zstd,18 |      20.50 |  262.656M |   13.162M |      4.85 |     0.973
   auto,zstd,19 |      21.87 |  262.410M |   12.337M |      5.17 |     0.973
   auto,zstd,20 |      20.43 |  262.762M |   13.207M |      4.83 |     0.974
   auto,zstd,21 |      21.59 |  262.517M |   12.497M |      5.10 |     0.973
   auto,zstd,22 |      24.10 |  262.394M |   11.196M |      5.70 |     0.972

Small Text Files (N = 2516), Mean: 0.06 MB, Std: 0.4 MB

Benchmark date: 2018-04-09
Borg version: borg 1.1.5
Python version: Python 3.6.4
Kernel version: Linux 4.15.15-1-ARCH
CPU model: Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz

Borg init command: %s init --error -e repokey %s
Borg create command: %s create --error -C %s %s::foo %s
Dataset path: /tmp/borgdataset (tmpfs)
Repository path: /tmp/borg-repo (tmpfs)

Averaging algos over 1 run(s)

           algo |    cputime |  reposize |   bytes/s | timeratio | compratio
----------------+------------+-----------+-----------+-----------+----------
           none |       3.50 |  152.375M |   43.536M |      1.00 |     1.000
            lz4 |       3.49 |  114.737M |   43.661M |      1.00 |     0.753
         zlib,0 |       3.57 |  152.400M |   42.682M |      1.02 |     1.000
         zlib,1 |       7.55 |  104.919M |   20.182M |      2.16 |     0.689
         zlib,2 |       7.75 |  104.542M |   19.661M |      2.21 |     0.686
         zlib,3 |       8.16 |  104.014M |   18.673M |      2.33 |     0.683
         zlib,4 |       8.46 |  103.633M |   18.011M |      2.42 |     0.680
         zlib,5 |       9.40 |  103.064M |   16.210M |      2.69 |     0.676
         zlib,6 |      11.25 |  102.593M |   13.544M |      3.21 |     0.673
         zlib,7 |      13.32 |  101.413M |   11.440M |      3.81 |     0.666
         zlib,8 |      21.11 |  102.236M | 7218.157K |      6.03 |     0.671
         zlib,9 |      32.94 |  102.207M | 4625.843K |      9.41 |     0.671
         lzma,0 |      29.96 |   99.594M | 5085.957K |      8.56 |     0.654
         lzma,1 |      37.16 |   99.033M | 4100.519K |     10.62 |     0.650
         lzma,2 |      37.57 |   98.804M | 4055.770K |     10.73 |     0.648
         lzma,3 |      39.16 |   98.693M | 3891.095K |     11.19 |     0.648
         lzma,4 |      56.38 |   97.382M | 2702.648K |     16.11 |     0.639
         lzma,5 |      61.89 |   97.055M | 2462.034K |     17.68 |     0.637
         lzma,6 |      64.31 |   96.936M | 2369.387K |     18.37 |     0.636
         lzma,7 |      95.28 |   96.895M | 1599.236K |     27.22 |     0.636
         lzma,8 |     126.31 |   96.932M | 1206.359K |     36.09 |     0.636
         lzma,9 |     123.99 |   96.920M | 1228.932K |     35.43 |     0.636
         zstd,1 |       3.98 |  104.194M |   38.285M |      1.14 |     0.684
         zstd,2 |       4.03 |  103.293M |   37.810M |      1.15 |     0.678
         zstd,3 |       4.19 |  102.470M |   36.366M |      1.20 |     0.672
         zstd,4 |       4.47 |  102.486M |   34.088M |      1.28 |     0.673
         zstd,5 |       5.45 |  102.052M |   27.959M |      1.56 |     0.670
         zstd,6 |       6.15 |  101.356M |   24.776M |      1.76 |     0.665
         zstd,7 |       6.70 |  101.118M |   22.743M |      1.91 |     0.664
         zstd,8 |       7.38 |  100.540M |   20.647M |      2.11 |     0.660
         zstd,9 |       7.98 |  100.475M |   19.095M |      2.28 |     0.659
        zstd,10 |       8.61 |  100.381M |   17.697M |      2.46 |     0.659
        zstd,11 |       8.92 |  100.401M |   17.082M |      2.55 |     0.659
        zstd,12 |      10.18 |  100.372M |   14.968M |      2.91 |     0.659
        zstd,13 |      14.20 |  100.192M |   10.731M |      4.06 |     0.658
        zstd,14 |      17.02 |  100.065M | 8952.720K |      4.86 |     0.657
        zstd,15 |      18.42 |  100.016M | 8272.274K |      5.26 |     0.656
        zstd,16 |      26.25 |   99.234M | 5804.773K |      7.50 |     0.651
        zstd,17 |      28.08 |   99.115M | 5426.470K |      8.02 |     0.650
        zstd,18 |      32.29 |   98.759M | 4718.962K |      9.23 |     0.648
        zstd,19 |      32.89 |   98.824M | 4632.876K |      9.40 |     0.649
        zstd,20 |      36.71 |   98.693M | 4150.784K |     10.49 |     0.648
        zstd,21 |      36.05 |   98.787M | 4226.776K |     10.30 |     0.648
        zstd,22 |      38.81 |   98.750M | 3926.186K |     11.09 |     0.648
       auto,lz4 |       3.67 |  114.565M |   41.519M |      1.05 |     0.752
    auto,zlib,0 |       3.51 |  114.561M |   43.412M |      1.00 |     0.752
    auto,zlib,1 |       5.49 |  105.312M |   27.755M |      1.57 |     0.691
    auto,zlib,2 |       5.93 |  104.825M |   25.696M |      1.69 |     0.688
    auto,zlib,3 |       6.34 |  104.346M |   24.034M |      1.81 |     0.685
    auto,zlib,4 |       6.34 |  104.055M |   24.034M |      1.81 |     0.683
    auto,zlib,5 |       7.34 |  103.408M |   20.760M |      2.10 |     0.679
    auto,zlib,6 |       9.45 |  102.887M |   16.124M |      2.70 |     0.675
    auto,zlib,7 |      11.41 |  102.687M |   13.355M |      3.26 |     0.674
    auto,zlib,8 |      19.16 |  102.662M | 7952.781K |      5.47 |     0.674
    auto,zlib,9 |      31.11 |  101.507M | 4897.952K |      8.89 |     0.666
    auto,lzma,0 |      13.53 |   99.324M |   11.262M |      3.87 |     0.652
    auto,lzma,1 |      18.34 |   99.344M | 8308.358K |      5.24 |     0.652
    auto,lzma,2 |      18.59 |   99.336M | 8196.627K |      5.31 |     0.652
    auto,lzma,3 |      20.88 |   99.000M | 7297.667K |      5.97 |     0.650
    auto,lzma,4 |      36.88 |   97.886M | 4131.651K |     10.54 |     0.642
    auto,lzma,5 |      41.39 |   97.313M | 3681.451K |     11.83 |     0.639
    auto,lzma,6 |      44.97 |   97.227M | 3388.376K |     12.85 |     0.638
    auto,lzma,7 |      69.86 |   97.317M | 2181.152K |     19.96 |     0.639
    auto,lzma,8 |      97.20 |   97.251M | 1567.647K |     27.77 |     0.638
    auto,lzma,9 |      98.05 |   97.219M | 1554.057K |     28.01 |     0.638
    auto,zstd,1 |       4.10 |  104.325M |   37.165M |      1.17 |     0.685
    auto,zstd,2 |       4.20 |  103.440M |   36.280M |      1.20 |     0.679
    auto,zstd,3 |       4.40 |  102.875M |   34.631M |      1.26 |     0.675
    auto,zstd,4 |       4.59 |  102.650M |   33.197M |      1.31 |     0.674
    auto,zstd,5 |       5.24 |  102.158M |   29.079M |      1.50 |     0.670
    auto,zstd,6 |       5.85 |  101.585M |   26.047M |      1.67 |     0.667
    auto,zstd,7 |       6.30 |  101.315M |   24.187M |      1.80 |     0.665
    auto,zstd,8 |       6.63 |  100.729M |   22.983M |      1.89 |     0.661
    auto,zstd,9 |       7.00 |  100.659M |   21.768M |      2.00 |     0.661
   auto,zstd,10 |       7.84 |  100.618M |   19.436M |      2.24 |     0.660
   auto,zstd,11 |       8.09 |  100.573M |   18.835M |      2.31 |     0.660
   auto,zstd,12 |       9.44 |  100.647M |   16.141M |      2.70 |     0.661
   auto,zstd,13 |      13.02 |  100.458M |   11.703M |      3.72 |     0.659
   auto,zstd,14 |      15.79 |  100.241M | 9650.113K |      4.51 |     0.658
   auto,zstd,15 |      18.04 |  100.225M | 8446.524K |      5.15 |     0.658
   auto,zstd,16 |      20.32 |   99.521M | 7498.784K |      5.81 |     0.653
   auto,zstd,17 |      21.93 |   99.217M | 6948.257K |      6.27 |     0.651
   auto,zstd,18 |      25.25 |   99.000M | 6034.665K |      7.21 |     0.650
   auto,zstd,19 |      25.25 |   99.152M | 6034.665K |      7.21 |     0.651
   auto,zstd,20 |      28.97 |   98.841M | 5259.761K |      8.28 |     0.649
   auto,zstd,21 |      29.42 |   98.984M | 5179.309K |      8.41 |     0.650
   auto,zstd,22 |      32.85 |   98.918M | 4638.517K |      9.39 |     0.649
#!/usr/bin/env php
<?php
/* Author: Romain "Artefact2" Dal Maso <artefact2@gmail.com> */
/* This program is free software. It comes without any warranty, to the
* extent permitted by applicable law. You can redistribute it and/or
* modify it under the terms of the Do What The Fuck You Want To Public
* License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details. */
const BORG_BINARY = '/home/romain/Downloads/borg-linux64';
const DATASET_DIR = '/tmp/borg-dataset';
const BORG_REPO = '/tmp/borg-repo';
const STATE_FILE = '/tmp/borg-compressbench.state';
const INIT_COMMAND = '%s init --error -e repokey %s';
const CREATE_COMMAND = '%s create --error -C %s %s::foo %s';
const RUNS = 1;
$compressions = [ 'lz4' ];
foreach([ 'zlib', 'lzma' ] as $algo) {
foreach(range(0, 9) as $level) {
$compressions[] = $algo.','.$level;
}
}
foreach($compressions as $comp) {
$compressions[] = 'auto,'.$comp;
}
array_unshift($compressions, 'none');
printf("Benchmark date: %s\n", gmdate('Y-m-d'));
printf("Borg version: %s", shell_exec(sprintf('%s --version', escapeshellarg(BORG_BINARY))));
printf("Python version: %s", shell_exec('python --version'));
printf("Kernel version: %s", shell_exec('uname -sr'));
printf("CPU model: %s", shell_exec('grep "model name" /proc/cpuinfo | head -n1 | cut -d\' \' -f3-'));
printf("\nBorg init command: %s\n", INIT_COMMAND);
printf("Borg create command: %s\n", CREATE_COMMAND);
printf("Dataset path: %s (%s)\n", DATASET_DIR, find_mountpoint(DATASET_DIR));
printf("Repository path: %s (%s)\n", BORG_REPO, find_mountpoint(BORG_REPO));
printf("\nAveraging algos over %d run(s)\n", RUNS);
putenv('BORG_PASSPHRASE=foobar');
if(file_exists(STATE_FILE)) {
$results = json_decode(file_get_contents(STATE_FILE), true);
fprintf(STDERR, "\nWARNING: resuming progress from state file %s\nDelete file if you want to start over.\n", STATE_FILE);
} else {
$results = [];;
}
const FORMAT = "%15s | %10s | %9s | %9s | %9s | %9s\n";
const IFORMAT = "%15s | %10.2f | %9s | %9s | %9.2f | %9.3f\n";
printf("\n".FORMAT, "algo", "cputime", "reposize", "bytes/s", "timeratio", "compratio");
echo strtr(sprintf(FORMAT, '', '', '', '', '', '', '', ''), ' |', '-+');
foreach($compressions as $comp) {
if(!isset($results[$comp])) {
$results[$comp] = [
'runs' => 0,
'cpu' => 0,
'size' => 0,
];
}
while($results[$comp]['runs'] < RUNS) {
passthru(sprintf('rm -Rf %s', escapeshellarg(BORG_REPO)));
passthru(sprintf(INIT_COMMAND,
escapeshellarg(BORG_BINARY),
escapeshellarg(BORG_REPO)));
$times = shell_exec('bash -c '.escapeshellarg(
sprintf('time -p '.CREATE_COMMAND,
escapeshellarg(BORG_BINARY),
escapeshellarg($comp),
escapeshellarg(BORG_REPO),
escapeshellarg(DATASET_DIR))
).' 2>&1');
preg_match_all('%^(real|user|sys) (?<time>.+)$%m', $times, $matches);
$results[$comp]['cpu'] += floatval($matches['time'][1]);
$results[$comp]['cpu'] += floatval($matches['time'][2]);
$du = shell_exec(sprintf('du -B 1 -s %s', escapeshellarg(BORG_REPO)));
preg_match('%^(?<total>[0-9]+)\s%m', $du, $match);
$results[$comp]['size'] += intval($match['total']);
++$results[$comp]['runs'];
$f = fopen(STATE_FILE, 'wb');
fwrite($f, json_encode($results));
fflush($f);
fclose($f);
}
printf(
IFORMAT,
$comp,
$results[$comp]['cpu'] / $results[$comp]['runs'],
format_bytes($results[$comp]['size'] / $results[$comp]['runs']),
format_bytes(($results['none']['size'] / $results['none']['runs']) / ($results[$comp]['cpu'] / $results[$comp]['runs'])),
($results[$comp]['cpu'] / $results[$comp]['runs']) / ($results['none']['cpu'] / $results['none']['runs']),
($results[$comp]['size'] / $results[$comp]['runs']) / ($results['none']['size'] / $results['none']['runs'])
);
}
function format_bytes(int $b, string $prec = '8.3') {
static $suffixes = [ 'B', 'K', 'M', 'G', 'T', 'P', 'E' ];
list($total, $decimals) = explode('.', $prec);
$cutoff = pow(10, $total - $decimals - 1);
$i = 0;
while($b >= $cutoff) {
$b /= 1000;
++$i;
}
return sprintf("%".$prec."f%s", $b, $suffixes[$i]);
}
function find_mountpoint($path) {
if($del = !file_exists($path)) {
touch($path);
}
$dev = shell_exec(sprintf('df %s | tail -n1 | cut -d\' \' -f1', escapeshellarg($path)));
if($del) unlink($path);
return substr($dev, 0, -1);
}
#!/bin/sh
# Run me in single-user mode:
# systemctl isolate rescue.target
for i in 1 2 3; do
rm -Rf /tmp/borg-dataset /tmp/borg-repo /tmp/borg-compressbench.state
cp -a /tmp/borg-dataset$i /tmp/borg-dataset
./borg-compressbench | tee bcb$i.txt
mv /tmp/borg-compressbench.state bcb$i.state
done
#!/usr/bin/python3
import sys
import numpy as np
import matplotlib.pyplot as plt
data = {}
stats = {}
average = {}
infiles = sys.argv[1:]
Ninfiles = len(infiles)
for file, n in zip( infiles, range(Ninfiles) ):
data[n] = np.genfromtxt(file, skip_header=19, skip_footer=1, delimiter="|", dtype='U20,f4,U20,U20,f4,f4')
data[n] = data[n].tolist()
data[n] = [ [cell.strip() if type(cell) == str else cell for cell in row] for row in data[n] ]
data[n] = np.array(data[n])
stats[n] = {}
stats[n]['algo'] = np.array(data[n][:,0], dtype=str)
stats[n]['timeratio'] = np.array(data[n][:,4], dtype=float)
stats[n]['compratio'] = np.array(data[n][:,5], dtype=float)
stats[n]['eff'] = [ stats[n]['timeratio'][i] * stats[n]['compratio'][i] for i in range( len( stats[n]['timeratio'] ) ) ]
stats[n]['eff'] = [ -i+2 for i in stats[n]['eff'] ]
with open(file) as f:
stats[n]['description'] = f.readline()
################## Calculate Average ##################
last = len(stats)
stats[last] = {}
stats[last]['algo'] = stats[0]['algo'].copy()
stats[last]['timeratio'] = stats[0]['timeratio'].copy()
stats[last]['compratio'] = stats[0]['compratio'].copy()
stats[last]['eff'] = stats[0]['eff'].copy()
stats[last]['description'] = 'Mean'
for i in range(len(stats[0]['algo'])):
stats[last]['timeratio'][i] = np.mean( [ stats[file]['timeratio'][i] for file in range(Ninfiles) ] )
stats[last]['compratio'][i] = np.mean( [ stats[file]['compratio'][i] for file in range(Ninfiles) ] )
stats[last]['eff'][i] = np.mean( [ stats[file]['eff'][i] for file in stats ] )
#######################################################
Nplots = [ stats[key]['description'] for key in stats.keys() ]
fig = plt.figure(figsize=(30,5))
xticklabels = data[0][:,0]
plotx = range( len( xticklabels ) )
ax_size = fig.add_subplot(111)
ax_size.set_xticks(plotx)
ax_size.set_xticklabels(xticklabels)
ax_size.set_title('Borg Compression Comparison')
ax_size.set_ylim([0,1])
xlabel = 'Compr. Algorithm[, Compr. Factor]'
ylabel_size = 'Size Relative to No Compression'
ylabel_time = 'Compression Time Relative to No Compression'
ylabel_efficiency = r'Efficiency: $(-1)\cdot$ Fraction Time $\cdot$ Fraction Size $+ 2$'
ax_time = ax_size.twinx()
ax_efficiency = ax_size.twinx()
colorfracs = [i / (Ninfiles+.1) if i > 0 else 0 for i in range( len(Nplots) )]
# Actual plotting
lns = []
for cfrac, n in zip( colorfracs, range(Ninfiles+1) ):
color = plt.cm.viridis(cfrac)
l_size, = ax_size.plot(plotx, stats[n]['compratio'],
color=color, linestyle='-.',
label='Size Ratio: {}'.format(stats[n]['description']))
l_time, = ax_time.plot(plotx, stats[n]['timeratio'],
color=color, linestyle=':',
label='Time Ratio: {}'.format(stats[n]['description']))
l_eff, = ax_efficiency.plot(plotx, stats[n]['eff'],
color=color, linestyle='-',
label='Efficiency: {}'.format(stats[n]['description']))
lns.append(l_size)
lns.append(l_time)
lns.append(l_eff)
ax_efficiency.spines['right'].set_position(('outward', 60))
ax_size.xaxis.grid(color='.85', linestyle='-', linewidth=.5)
for tick in ax_size.get_xticklabels():
tick.set_rotation(45)
tick.set_horizontalalignment('right')
ax_size.set_xlabel(xlabel)
ax_size.set_ylabel(ylabel_size)
ax_efficiency.set_ylabel(ylabel_efficiency)
ax_time.set_ylabel(ylabel_time)
lgd = ax_time.legend(handles=lns, loc='upper center', ncol=2,
bbox_to_anchor=(0.5, -.35), facecolor='#FFFFFF',
prop={'family': 'monospace','size': 'medium'})
fig.savefig('eval.svg', bbox_inches='tight', dpi=300)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment