Sign inSign up

flaviostutz/benchmark

By flaviostutz

•Updated almost 6 years ago

Language benchmarks. This container has runtime for various languages.

Image
0

2.2K

flaviostutz/benchmark repository overview

⁠Table of Content

⁠Overview

The benchmarks follow the criteria:

  • They are written as the average software developer would write them, i.e.

    • The algorithms are implemented as cited in public sources;
    • The libraries are used as described in the tutorials, documentation and examples;
    • The used data structures are idiomatic.
  • The used algorithms are similar between the languages (as the reference implementations), variants are acceptable if the reference implementation exists.

  • All final binaries are releases (optimized for performance if possible) as debug performance may vary too much depending on the compiler.

My other benchmarks: jit-benchmarks⁠, crystal-benchmarks-game⁠

⁠Measurements

The measured values are:

  • time spent for the benchmark execution (loading required data and code self-testing are not measured);
  • memory consumption of the benchmark process, reported as base + increase, where base is the RSS before the benchmark and increase is the peak increase of the RSS during the benchmark;
  • energy consumption of the CPU (PP0 package) during the benchmark.

All values are presented as: median±median absolute deviation.

UPDATE: 2020-12-01

⁠Test Cases

⁠Brainfuck

Testing brainfuck implementations using two code samples (bench.b and mandel.b). Supports two mode:

  • Verbose (default). Prints the output immediately.
  • Quiet (if QUIET environment variable is set). Accumulates the output using Fletcher-16 checksum, and prints it out after the benchmark.

Brainfuck⁠

⁠bench.b
LanguageTime, sMemory, MiBEnergy, J
C++/g++0.892±0.0441.49±00.03 + 0.00±00.0015.92±00.43
Kotlin1.705±0.01838.11±00.12 + 2.12±00.0738.89±00.47
D/ldc21.832±0.0233.06±00.03 + 0.00±00.0033.17±01.19
Nim/gcc1.860±0.0361.92±00.04 + 0.00±00.0035.16±02.06
C/gcc1.887±0.0340.50±00.00 + 0.00±00.0036.04±00.71
Rust1.921±0.0362.02±00.06 + 0.00±00.0045.72±01.08
Nim/clang1.921±0.0362.37±00.05 + 0.00±00.0044.39±01.02
D/gdc1.950±0.0346.34±00.07 + 0.00±00.0037.39±01.93
C/clang2.223±0.0660.50±00.00 + 0.00±00.0042.64±01.37
OCaml2.230±0.0262.60±00.02 + 2.50±00.0342.50±01.23
Go2.241±0.0343.53±00.08 + 0.00±00.0050.55±01.43
Vala/clang2.316±0.0263.73±00.04 + 0.00±00.0054.54±00.49
Crystal2.317±0.0213.37±00.01 + 0.00±00.0055.93±01.28
Vala/gcc2.335±0.0623.77±00.04 + 0.00±00.0047.62±01.82
C#/.NET Core2.341±0.08934.18±00.04 + 0.01±00.0048.13±04.76
V/gcc2.433±0.0710.50±00.00 + 0.00±00.0051.49±01.99
Java2.458±0.11337.49±00.09 + 0.96±00.1148.82±02.17
Go/gccgo2.593±0.20320.93±00.22 + 0.00±00.0052.43±10.28
V/clang2.742±0.1060.87±00.00 + 0.00±00.0057.97±03.80
MLton2.841±0.0301.44±00.05 + 0.25±00.0069.59±01.25
Chez Scheme2.898±0.13624.87±00.05 + 4.23±00.0961.62±05.33
Julia2.989±0.124169.09±00.12 + 0.00±00.0052.77±03.78
D/dmd3.398±0.0513.58±00.04 + 0.00±00.0075.85±04.16
Scala3.451±0.03680.33±00.31 + 63.22±04.3870.71±01.84
Node.js3.876±0.09129.72±00.07 + 2.08±00.0086.57±02.19
C#/Mono4.047±0.03520.14±00.06 + 0.00±00.0093.13±00.66
Haskell (MArray)4.626±0.0653.52±00.05 + 1.23±00.00104.52±07.29
F#/.NET Core5.759±0.06036.41±00.05 + 90.04±00.54122.34±02.41
Lua/luajit6.266±0.0562.84±00.05 + 0.00±00.00134.09±03.45
Racket10.241±0.263101.02±00.05 + 0.00±00.00188.03±09.99
Ruby/truffleruby (--jvm)11.014±0.785554.32±05.28 + 467.70±85.03346.21±23.03
Python/pypy14.634±0.48363.77±00.19 + 45.38±00.00348.98±16.82
Haskell16.436±0.4054.28±00.05 + 1.00±00.00320.67±10.52
Ruby/truffleruby21.492±1.470253.22±00.14 + 638.77±14.18517.59±37.53
Lua57.236±1.6272.67±00.01 + 0.00±00.001122.15±58.58
Ruby (--jit)61.421±1.97814.12±00.05 + 0.15±00.001122.68±34.10
Ruby82.449±3.31514.15±00.05 + 0.00±00.001706.93±130.86
Ruby/jruby109.907±2.647202.52±03.44 + 236.59±02.422259.77±110.02
Elixir119.090±1.21756.61±01.01 + 0.00±00.002268.87±68.60
Python235.009±4.6799.45±00.03 + 0.00±00.004650.00±179.37
Tcl (FP)279.844±8.0994.28±00.03 + 0.00±00.005693.86±351.71
Perl361.937±3.2376.51±00.04 + 0.00±00.007386.06±407.83
Tcl (OOP)540.958±12.9884.26±00.09 + 0.00±00.0011178.46±579.19
⁠mandel.b

Mandel in Brainfuck⁠

LanguageTime, sMemory, MiBEnergy, J
D/ldc213.023±0.1413.02±00.04 + 0.77±00.00282.47±15.54
C/gcc13.024±0.0440.49±00.00 + 1.11±00.02232.35±06.92
C++/g++13.508±0.5193.14±00.14 + 0.49±00.02243.38±14.88
D/gdc13.622±0.4866.68±00.06 + 0.52±00.00284.97±15.61
V/gcc13.929±0.3450.55±00.05 + 1.88±00.06263.36±22.17
Kotlin16.201±0.63937.89±00.20 + 2.53±00.14333.78±12.48
C/clang17.205±0.2960.54±00.00 + 1.09±00.02409.86±07.81
C#/.NET Core17.817±0.20634.36±00.02 + 1.06±00.06386.31±09.90
Nim/gcc18.909±0.5731.81±00.04 + 0.57±00.05364.59±13.74
Rust19.121±0.3652.06±00.09 + 0.28±00.03450.43±14.62
V/clang19.954±0.1440.85±00.00 + 1.97±00.09354.30±05.02
Nim/clang21.089±0.8392.31±00.07 + 0.51±00.00427.52±33.64
Vala/clang21.997±0.5583.54±00.04 + 2.02±00.02417.73±08.93
Java22.059±2.00937.61±00.10 + 1.41±00.15438.82±32.38
Vala/gcc22.339±0.4953.55±00.02 + 2.05±00.02395.91±13.76
Scala22.953±0.28080.06±00.43 + 38.70±03.31533.87±10.60
Go/gccgo23.761±0.45633.35±00.22 + 1.28±00.05519.74±23.32
Crystal23.958±0.2973.32±00.04 + 0.45±00.02442.85±08.69
Go34.576±0.7723.50±00.03 + 1.24±00.01636.21±19.42
OCaml36.101±0.6743.81±00.03 + 7.19±01.04809.54±37.56
Chez Scheme38.361±0.22325.47±00.03 + 3.65±00.02928.03±21.01
D/dmd40.256±0.1163.48±00.03 + 0.77±00.00890.37±04.94
C#/Mono43.907±0.60120.06±00.06 + 0.88±00.00974.19±30.51
Node.js45.577±1.51129.36±00.12 + 6.12±00.01911.95±74.08
MLton52.145±0.5921.40±00.03 + 4.11±00.00997.68±30.34
Julia57.873±1.982168.56±00.17 + 0.00±00.001150.80±96.19
Python/pypy65.443±0.41564.01±00.25 + 45.97±00.091537.62±41.76
Haskell (MArray)65.728±1.7313.56±00.09 + 2.74±00.001333.81±82.75
Ruby/truffleruby (--jvm)127.906±1.069553.57±06.48 + 384.87±17.422850.44±62.68
F#/.NET Core133.896±0.44836.46±00.05 + 91.62±00.122663.72±08.90
Racket167.016±3.127100.96±00.07 + 0.00±00.003106.19±93.72
Ruby/truffleruby169.044±5.202252.82±00.38 + 661.55±17.473637.07±123.52
Haskell224.213±5.5163.65±00.06 + 26.29±00.004739.08±376.63
Lua/luajit246.285±3.7922.79±00.03 + 0.86±00.004889.38±291.91

⁠Base64

Testing base64 encoding/decoding of the large blob into the newly allocated buffers.

Base64⁠

LanguageTime, sMemory, MiBEnergy, J
C/gcc (aklomp)0.156±0.0021.90±00.02 + 0.00±00.003.43±00.14
C/gcc1.190±0.0101.87±00.04 + 0.00±00.0024.92±00.52
Rust1.246±0.0452.49±00.08 + 0.01±00.0128.21±00.74
V/clang1.522±0.0261.98±00.04 + 0.47±00.0132.63±00.77
V/gcc1.624±0.0261.73±00.03 + 0.23±00.1135.31±01.20
D/ldc21.745±0.0113.40±00.02 + 3.66±00.0030.74±00.31
Nim/clang1.877±0.0242.68±00.06 + 4.41±00.0333.76±01.21
Nim/gcc2.048±0.0752.23±00.05 + 4.44±00.0040.58±03.26
Crystal2.100±0.0063.76±00.03 + 1.79±00.0243.08±00.46
D/gdc2.137±0.0157.05±00.09 + 3.46±00.0337.92±01.38
Java2.248±0.03238.45±00.09 + 360.35±13.1249.02±02.22
Ruby2.336±0.02914.41±00.05 + 42.64±00.9053.21±02.22
Ruby (--jit)2.364±0.04814.47±00.04 + 43.78±00.0653.65±03.10
Kotlin2.411±0.05839.43±00.08 + 339.98±11.4351.45±02.95
Go2.497±0.0074.52±00.13 + 4.89±00.1047.17±00.43
Scala2.518±0.02881.21±00.46 + 64.54±07.6255.40±03.45
C++/g++ (libcrypto)2.623±0.0285.34±00.04 + 0.07±00.0047.14±00.51
PHP2.945±0.03115.72±00.15 + 0.00±00.0051.14±01.07
Perl (MIME::Base64)3.024±0.04614.16±00.03 + 0.02±00.0052.92±01.33
Node.js3.065±0.03029.89±00.05 + 1029.92±00.0767.19±00.76
Go/gccgo3.660±0.01222.07±00.12 + 7.22±00.2272.73±00.40
D/dmd3.663±0.0663.67±00.06 + 3.67±00.0074.06±00.79
Tcl4.295±0.0725.06±00.05 + 0.00±00.0073.76±01.81
Python/pypy4.723±0.11764.13±00.15 + 45.72±00.05101.07±05.88
C#/.NET Core5.213±0.06234.44±00.09 + 41.21±01.2097.46±00.94
Python5.448±0.1129.21±00.05 + 0.18±00.00102.56±05.80
Julia5.857±0.093200.32±00.21 + 42.88±00.21111.74±01.76
Ruby/truffleruby (--jvm)5.859±0.142551.20±02.74 + 399.55±28.65124.74±07.81
C#/Mono7.565±0.20420.60±00.05 + 18.49±00.06144.66±05.48
Ruby/jruby9.862±0.279192.07±03.01 + 173.11±05.41213.68±16.56
Perl (MIME::Base64::Perl)16.414±0.63115.46±00.05 + 0.20±00.08353.95±27.54
Ruby/truffleruby20.647±0.721253.00±00.31 + 404.70±00.60413.32±37.94

⁠Json

Testing parsing and simple calculating of values from a big JSON file.

Json⁠

LanguageTime, sMemory, MiBEnergy, J
C++/g++ (DAW JSON Link)0.082±0.002109.27±00.02 + 0.00±00.001.95±00.06
C++/g++ (simdjson On-Demand)0.088±0.001109.90±00.05 + 59.81±00.121.69±00.08
D/gdc (fast)0.100±0.001219.98±00.03 + 11.12±00.032.58±00.06
Rust (Serde Custom)0.141±0.001108.43±00.09 + 0.00±00.002.35±00.04
Rust (Serde Typed)0.150±0.001108.48±00.07 + 11.51±00.032.52±00.04
C++/g++ (gason)0.158±0.004109.25±00.01 + 97.17±00.033.19±00.21
C++/g++ (simdjson DOM)0.160±0.003109.81±00.03 + 176.60±00.003.21±00.08
C++/g++ (RapidJSON)0.229±0.006109.27±00.02 + 128.82±00.004.51±00.35
C++/g++ (Boost.JSON)0.481±0.009109.80±00.03 + 435.70±00.0011.83±00.26
Java0.528±0.018252.65±00.15 + 75.46±01.5714.53±00.36
C++/g++ (RapidJSON SAX)0.534±0.021109.46±00.02 + 0.00±00.0011.52±00.82
Scala0.609±0.009327.43±00.58 + 73.55±00.8716.90±00.72
Julia (JSON3)0.615±0.031355.85±00.44 + 243.86±02.2013.47±01.25
Node.js0.663±0.010242.73±00.08 + 185.38±00.8214.04±00.37
Go (jsoniter)0.702±0.019224.79±00.11 + 13.89±00.1514.43±01.07
Python/pypy0.780±0.013277.41±00.16 + 127.96±00.0018.71±00.61
Rust (Serde Untyped)0.846±0.013108.48±00.08 + 839.98±00.0019.09±00.42
Crystal (Pull)0.856±0.033110.30±00.05 + 18.20±00.0416.65±01.40
Crystal (Schema)0.883±0.039110.36±00.03 + 47.05±00.0815.84±01.53
C#/.NET Core (System.Text.Json)0.982±0.018465.50±00.22 + 135.59±00.1022.84±00.75
Perl (Cpanel::JSON::XS)1.000±0.013121.32±00.06 + 402.72±00.0018.21±00.37
Go1.129±0.049113.94±00.19 + 95.95±00.0222.35±01.99
Crystal1.147±0.029110.37±00.03 + 393.35±00.0324.00±01.31
PHP1.204±0.012121.69±00.09 + 682.01±00.0025.92±00.20
V/gcc1.211±0.024107.42±00.01 + 484.49±00.0327.41±00.83
V/clang1.299±0.021107.91±00.03 + 484.48±00.0329.13±01.05
Go/gccgo1.401±0.025132.57±00.07 + 95.88±00.2031.66±01.06
Nim/gcc (Packedjson)1.458±0.035108.80±00.04 + 290.55±00.0031.04±03.08
Nim/clang (Packedjson)1.459±0.028109.22±00.08 + 290.55±00.0034.02±00.59
C++/g++ (json-c)1.561±0.044109.42±00.01 + 1216.08±00.0030.31±01.55
Clojure1.561±0.053491.24±08.10 + 516.55±22.5942.27±01.67
Haskell1.701±0.0244.41±00.03 + 5.42±00.0339.66±00.56
C#/.NET Core1.736±0.054474.19±00.09 + 288.64±00.0630.96±01.72
Nim/gcc1.756±0.020108.60±00.11 + 915.75±00.0639.94±01.11
Python1.757±0.056115.88±00.05 + 377.23±00.0138.02±02.48
CPython (UltraJSON)1.771±0.020117.52±00.04 + 545.45±00.9035.77±00.50
Nim/clang1.880±0.064109.09±00.10 + 915.65±00.1037.34±03.24
C#/Mono2.072±0.048462.61±00.08 + 0.18±00.0045.96±02.08
Ruby (YAJL)2.183±0.061120.60±00.03 + 286.98±00.0150.23±02.52
D/gdc2.234±0.115113.23±00.03 + 600.32±00.0044.22±05.07
Ruby2.260±0.067120.71±00.04 + 277.85±00.0442.18±01.80
Ruby (--jit)2.316±0.029120.76±00.02 + 277.83±00.0544.52±01.57
D/ldc22.503±0.033109.55±00.05 + 680.07±00.0450.98±01.91
Rust (jq)3.578±0.063110.41±00.05 + 774.34±00.2679.25±01.55
Ruby/jruby3.815±0

Tag summary

Content type

Image

Digest

Size

4.7 GB

Last updated

almost 6 years ago

docker pull flaviostutz/benchmark