All Projects → kostya → Benchmarks

kostya / Benchmarks

Licence: mit
Some benchmarks of different languages

Programming Languages

Makefile
30231 projects
C++
36643 projects - #6 most used programming language
ruby
36898 projects - #4 most used programming language
java
68154 projects - #9 most used programming language
rust
11053 projects
Zig
133 projects

Projects that are alternatives of or similar to Benchmarks

Proprietary vendor lge
Stars: ✭ 143 (-93.22%)
Mutual labels:  makefile
Pokemon Svg
SVGs for Pokemon
Stars: ✭ 147 (-93.03%)
Mutual labels:  makefile
Arduino Makefile
Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial.
Stars: ✭ 1,893 (-10.2%)
Mutual labels:  makefile
Proprietary vendor motorola
Stars: ✭ 143 (-93.22%)
Mutual labels:  makefile
Ansibleplaybook Rancher
Ansible playbook to keep a Rancher container running on a docker host
Stars: ✭ 146 (-93.07%)
Mutual labels:  makefile
Sd Maskrcnn
Code for SD Mask R-CNN Project
Stars: ✭ 150 (-92.88%)
Mutual labels:  makefile
Rbcurse
ruby based curses widgets: fields, buttons, textarea. menus, message boxes, tabbed panes, tables, listboxes, splitpanes, scrollpanes. Event based, MVC architecture. (DEPRECATED - PLS USE rbcurse-core)
Stars: ✭ 142 (-93.26%)
Mutual labels:  makefile
Pcl Cn
Practical Common Lisp (中英文对照版) - for Chinese only
Stars: ✭ 155 (-92.65%)
Mutual labels:  makefile
Securekubernetes
Attacking and Defending Kubernetes Clusters: A Guided Tour
Stars: ✭ 146 (-93.07%)
Mutual labels:  makefile
Book Open Source Tips
Open Source book on Open Source Tips
Stars: ✭ 152 (-92.79%)
Mutual labels:  makefile
Smarchglasses public
Stars: ✭ 143 (-93.22%)
Mutual labels:  makefile
Keyboard Pcbs
Keyboard PCBs
Stars: ✭ 146 (-93.07%)
Mutual labels:  makefile
Kube Yarn
Running YARN on Kubernetes with PetSet controller.
Stars: ✭ 150 (-92.88%)
Mutual labels:  makefile
Terraform Makefile
Helps me actually use terraform for multiple environments
Stars: ✭ 143 (-93.22%)
Mutual labels:  makefile
Device essential mata
Essential PH-1 device
Stars: ✭ 153 (-92.74%)
Mutual labels:  makefile
Gb
A minimal C implementation of Nintendo Gameboy - An fast research environment for Reinforcement Learning
Stars: ✭ 143 (-93.22%)
Mutual labels:  makefile
Real World Kubernetes
disaster recovery, security, and high-availability setups for kubernetes tutorials
Stars: ✭ 149 (-92.93%)
Mutual labels:  makefile
Esp Open Sdk
Free and open (as much as possible) integrated SDK for ESP8266/ESP8285 chips
Stars: ✭ 1,884 (-10.63%)
Mutual labels:  makefile
Lpic1book
Stars: ✭ 155 (-92.65%)
Mutual labels:  makefile
Gitmagic
A guide to using Git
Stars: ✭ 1,852 (-12.14%)
Mutual labels:  makefile

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: 2021-10-29

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

Language Time, s Memory, MiB Energy, J
Racket (Syntax Objects) 1.367±0.021 111.52±00.23 + 0.00±00.00 31.96±01.66
C++/g++ 1.561±0.063 1.66±00.03 + 0.00±00.00 31.70±02.61
Rust 1.735±0.039 1.96±00.06 + 0.00±00.00 40.24±02.18
D/ldc2 1.780±0.069 3.07±00.04 + 0.00±00.00 36.39±03.16
C/clang 1.827±0.041 0.63±00.00 + 0.00±00.00 41.53±00.81
D/gdc 1.839±0.027 6.70±00.06 + 0.00±00.00 42.66±01.05
Zig 1.861±0.024 1.01±00.03 + 0.00±00.00 41.37±00.72
C/gcc 1.929±0.049 0.63±00.00 + 0.00±00.00 35.99±02.36
C++/clang++ 1.992±0.056 1.63±00.00 + 0.00±00.00 37.10±00.95
Nim/gcc 2.019±0.095 1.82±00.04 + 0.00±00.00 43.98±03.01
Kotlin 2.026±0.109 40.23±00.53 + 1.32±00.56 35.95±01.77
Java 2.041±0.044 36.85±00.18 + 1.58±00.16 45.91±01.49
Go/gccgo 2.046±0.107 22.23±00.05 + 0.00±00.00 38.40±03.55
Go 2.064±0.067 3.34±00.04 + 0.00±00.00 38.42±01.47
Vala/gcc 2.129±0.029 4.20±00.03 + 0.00±00.00 46.43±01.00
Nim/clang 2.181±0.082 2.29±00.05 + 0.00±00.00 49.29±01.95
OCaml 2.219±0.104 2.61±00.02 + 2.55±00.01 44.37±04.54
F#/.NET Core 2.219±0.033 36.94±00.01 + 0.31±00.00 48.44±00.62
Racket 2.279±0.038 95.53±00.33 + 0.00±00.00 44.95±06.21
C#/.NET Core 2.320±0.110 34.47±00.04 + 0.01±00.00 47.14±04.77
V/gcc 2.435±0.042 0.64±00.01 + 0.00±00.00 55.66±00.38
Crystal 2.448±0.111 3.33±00.02 + 0.00±00.00 49.11±04.24
Vala/clang 2.523±0.047 4.12±00.05 + 0.00±00.00 45.88±00.68
MLton 2.639±0.059 1.45±00.01 + 0.25±00.00 62.65±02.78
Chez Scheme 2.946±0.126 24.81±00.07 + 4.42±00.07 58.58±05.35
V/clang 3.104±0.096 0.66±00.03 + 0.00±00.00 70.27±04.07
Julia 3.135±0.132 200.09±00.18 + 0.62±00.05 61.50±06.33
Scala 3.573±0.061 75.12±00.25 + 151.67±25.23 71.59±03.15
D/dmd 3.695±0.087 3.49±00.05 + 0.00±00.00 65.45±01.63
C#/Mono 4.233±0.194 20.01±00.08 + 0.00±00.00 83.25±08.12
Node.js 4.643±0.037 33.59±00.03 + 3.48±00.00 77.88±01.80
Haskell (MArray) 4.785±0.211 3.72±00.05 + 1.11±00.00 100.19±08.87
Swift 5.583±0.052 13.12±00.05 + 0.00±00.00 124.99±02.94
Lua/luajit 7.501±0.228 2.39±00.02 + 0.00±00.00 162.99±05.74
Ruby/truffleruby 9.657±0.545 445.46±01.50 + 557.11±04.22 242.54±22.15
Ruby/truffleruby (--jvm) 10.199±0.252 586.60±03.23 + 619.78±16.04 339.90±20.43
Python/pypy 13.991±0.086 63.50±00.10 + 46.97±00.07 349.52±05.04
Haskell 16.044±0.573 3.83±00.03 + 0.81±00.00 344.33±29.95
Lua 56.323±0.979 2.24±00.07 + 0.00±00.00 1208.76±54.77
Ruby (--jit) 59.255±1.875 14.03±00.02 + 0.23±00.00 1259.13±100.01
Elixir 59.969±1.827 76.49±01.32 + 0.11±00.11 1126.02±79.12
Ruby 100.234±2.333 14.00±00.02 + 0.00±00.00 1918.36±139.45
Ruby/jruby 108.515±2.453 185.95±01.93 + 143.09±18.56 2243.51±30.54
Python 234.584±6.561 10.34±00.02 + 0.00±00.00 4765.63±355.18
Tcl (FP) 279.893±8.152 4.22±00.03 + 0.00±00.00 5532.51±299.02
Perl 365.708±2.632 6.46±00.06 + 0.00±00.00 6818.18±58.85
Tcl (OOP) 565.010±8.616 4.23±00.04 + 0.00±00.00 10590.30±209.71

mandel.b

Mandel in Brainfuck

Language Time, s Memory, MiB Energy, J
C++/g++ 11.561±0.257 2.53±00.89 + 1.37±00.86 198.02±10.79
C/gcc 12.638±0.191 0.63±00.00 + 1.00±00.04 271.04±04.12
Rust 13.468±0.603 1.99±00.07 + 0.31±00.03 260.96±26.40
C/clang 14.006±0.558 0.69±00.00 + 0.95±00.03 277.62±28.40
D/ldc2 14.538±0.642 3.07±00.06 + 0.77±00.00 281.89±29.43
C++/clang++ 14.970±0.181 3.39±00.07 + 0.52±00.00 257.64±03.78
V/gcc 16.302±0.336 1.70±00.05 + 1.03±00.00 354.12±17.95
D/gdc 16.355±0.228 6.66±00.03 + 0.52±00.01 352.08±04.88
Kotlin 16.475±0.357 40.54±00.15 + 1.47±00.68 344.24±10.88
Zig 16.566±0.264 1.86±00.03 + 0.52±00.00 369.81±12.63
Go 16.775±0.359 3.27±00.04 + 1.26±00.00 362.23±18.24
Racket (Syntax Objects) 17.202±0.465 111.70±00.16 + 69.09±00.26 321.72±05.79
Crystal 18.466±0.693 3.35±00.03 + 0.43±00.04 375.10±23.81
Nim/gcc 19.017±0.672 1.83±00.04 + 0.51±00.00 332.29±13.09
C#/.NET Core 19.969±0.442 34.52±00.05 + 1.06±00.06 355.62±07.49
Vala/clang 20.178±0.180 4.00±00.06 + 1.96±00.06 453.66±12.56
Vala/gcc 20.321±0.647 4.02±00.09 + 1.99±00.06 407.74±32.77
Nim/clang 21.227±0.693 2.28±00.06 + 0.54±00.03 428.60±39.25
Java 21.415±1.823 36.94±00.43 + 2.10±00.22 432.08±13.84
Swift 22.341±0.790 13.84±00.16 + 0.00±00.00 456.48±39.37
Go/gccgo 22.386±0.531 22.33±00.10 + 1.30±00.03 376.18±06.41
Scala 25.819±0.453 75.74±00.48 + 126.67±00.13 528.38±24.50
V/clang 27.096±0.151 1.71±00.08 + 1.03±00.13 482.06±10.44
F#/.NET Core 34.720±1.446 36.91±00.05 + 2.10±00.02 651.90±38.35
OCaml 37.501±1.039 3.92±00.03 + 9.00±01.68 757.51±56.05
Chez Scheme 39.244±0.525 25.65±00.06 + 3.68±00.03 912.03±17.86
Racket 39.329±1.385 95.78±00.22 + 0.00±00.00 740.93±21.01
D/dmd 42.036±0.418 3.51±00.02 + 0.77±00.00 939.92±17.87
C#/Mono 45.269±1.684 20.00±00.03 + 0.87±00.00 954.08±51.91
Lua/luajit 45.359±0.918 2.37±00.04 + 0.44±00.00 834.79±30.69
Node.js 50.321±1.956 33.56±00.02 + 6.51±00.12 913.61±34.03
MLton 50.858±0.634 1.48±00.05 + 4.11±00.00 1148.64±18.38
Haskell (MArray) 59.687±0.301 3.70±00.02 + 2.62±00.00 1383.22±15.33
Python/pypy 65.668±2.354 63.37±00.05 + 47.76±00.05 1333.51±81.90
Julia 75.405±1.755 200.84±00.22 + 0.61±00.00 1569.12±122.00
Ruby/truffleruby (--jvm) 120.743±5.839 581.66±04.97 + 539.81±13.64 2466.87±108.51
Ruby/truffleruby 131.313±4.944 445.97±01.32 + 574.91±13.29 2693.24±211.06
Haskell 220.958±4.270 3.81±00.02 + 26.13±00.00 4785.77±295.26

Base64

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

Base64

Language Time, s Memory, MiB Energy, J
C/clang (aklomp) 0.138±0.006 1.99±00.02 + 0.00±00.00 3.22±00.06
C/gcc (aklomp) 0.143±0.004 2.02±00.03 + 0.00±00.00 3.30±00.09
Rust 1.214±0.035 2.53±00.05 + 0.01±00.01 21.33±00.76
C/gcc 1.223±0.039 1.95±00.04 + 0.00±00.00 23.75±01.20
Nim/gcc 1.325±0.045 2.28±00.03 + 4.12±00.00 25.65±02.32
V/clang 1.326±0.054 1.82±00.03 + 0.06±00.06 25.64±01.98
V/gcc 1.496±0.037 2.19±00.04 + 0.00±00.00 25.95±00.76
C/clang 1.498±0.063 1.99±00.04 + 0.00±00.00 28.50±02.14
Nim/clang 1.648±0.061 2.74±00.07 + 4.38±00.03 32.85±03.03
D/ldc2 1.852±0.040 3.51±00.04 + 3.63±00.00 33.83±00.82
Crystal 2.066±0.008 3.84±00.02 + 1.24±00.06 54.16±00.92
Ruby 2.069±0.060 14.47±00.04 + 56.72±01.25 40.96±03.11
Ruby (--jit) 2.090±0.071 14.50±00.02 + 56.97±00.90 42.45±03.61
Vala/clang 2.158±0.042 5.53±00.06 + 0.50±00.01 44.95±01.73
Vala/gcc 2.162±0.057 5.48±00.03 + 0.57±00.04 45.44±01.42
Java 2.221±0.058 39.00±00.15 + 241.56±00.85 43.91±02.02
Kotlin 2.405±0.043 41.57±00.32 + 241.80±00.16 47.72±01.82
Scala 2.428±0.052 75.08±00.34 + 223.54±00.27 46.71±01.10
Go 2.595±0.009 4.47±00.02 + 5.39±00.14 51.93±00.66
C++/clang++ (libcrypto) 2.736±0.063 5.65±00.03 + 0.08±00.00 58.36±01.49
C++/g++ (libcrypto) 2.737±0.088 5.62±00.03 + 0.08±00.01 58.77±03.27
PHP 2.748±0.035 15.80±00.08 + 0.00±00.00 58.78±00.63
Node.js 3.072±0.041 34.24±00.03 + 36.38±00.05 61.58±01.89
Go/gccgo 3.077±0.007 23.28±00.23 + 8.87±00.35 67.33±01.20
Perl (MIME::Base64) 3.151±0.037 14.08±00.04 + 0.04±00.03 52.92±00.63
D/gdc 3.421±0.132 7.02±00.03 + 3.41±00.02 63.34±05.83
D/dmd 3.836±0.135 4.00±00.07 + 3.62±00.00 66.05±02.78
Python 3.957±0.061 10.11±00.02 + 0.18±00.00 85.37±03.11
Zig 4.496±0.065 1.89±00.02 + 0.37±00.00 78.19±02.97
Tcl 5.014±0.136 4.84±00.05 + 0.19±00.00 85.69±02.14
Python/pypy 5.181±0.106 63.18±00.06 + 47.58±00.07 89.58±05.14
F#/.NET Core 5.851±0.057 37.26±00.06 + 33.61±06.18 107.97±01.45
C#/.NET Core 5.929±0.018 34.75±00.06 + 33.53±06.20 108.73±01.08
Julia 5.959±0.097 219.92±00.10 + 63.12±00.07 127.82±08.80
Ruby/truffleruby (--jvm) 6.169±0.108 578.96±02.64 + 263.18±30.25 135.51±03.74
C#/Mono 7.695±0.199 20.70±00.05 + 18.46±00.07 151.76±10.94
Ruby/jruby 12.535±0.199 185.46±01.81 + 131.82±03.34 259.51±13.05
Perl (MIME::Base64::Perl) 18.103±0.519 15.48±00.04 + 0.20±00.05 337.14±19.28
Ruby/truffleruby 20.236±0.501 442.51±01.45 + 320.98±00.80 419.55±08.23

Json

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

Few notes:

Json

Language Time, s Memory, MiB Energy, J
C++/clang++ (DAW JSON Link NoCheck) 0.085±0.005 113.10±00.02 + 0.00±00.00 1.75±00.10
C++/clang++ (simdjson On-Demand) 0.089±0.001 113.37±00.02 + 59.81±00.00 1.83±00.02
C++/g++ (simdjson On-Demand) 0.089±0.001 113.41±00.03 + 59.81±00.00 1.52±00.04
C++/g++ (DAW JSON Link NoCheck) 0.094±0.001 113.14±00.02 + 0.00±00.00 1.94±00.03
C++/clang++ (DAW JSON Link) 0.109±0.001 113.13±00.04 + 0.00±00.00 2.43±00.02
C++/g++ (DAW JSON Link) 0.109±0.004 113.14±00.03 + 0.00±00.00 2.33±00.07
Rust (Serde Custom) 0.146±0.007 111.85±00.08 + 0.00±00.00 2.96±00.38
Rust (Serde Typed) 0.151±0.008 111.85±00.04 + 11.54±00.26 3.06±00.36
C++/clang++ (simdjson DOM) 0.155±0.001 113.37±00.07 + 176.60±00.00 3.25±00.09
C++/g++ (gason) 0.164±0.002 113.04±00.04 + 96.80±00.06 4.19±00.10
C++/g++ (simdjson DOM) 0.169±0.004 113.37±00.03 + 176.60±00.00 3.02±00.13
C++/clang++ (gason) 0.181±0.002 113.11±00.05 + 96.80±00.06 4.82±00.10
C++/g++ (RapidJSON) 0.224±0.002 113.14±00.05 + 128.82±00.06 4.26±00.06
D/ldc2 (Mir Asdf DOM) 0.226±0.006 112.78±00.05 + 61.36±00.01 4.96±00.36
D/ldc2 (Mir Amazon's Ion DOM) 0.231±0.006 112.74±00.04 + 16.25±00.00 5.20±00.38
C++/clang++ (RapidJSON) 0.269±0.004 113.17±00.03 + 128.82±00.06 5.05±00.17
C++/g++ (RapidJSON Precise) 0.296±0.003 113.15±00.04 + 128.88±00.00 5.88±00.23
C++/clang++ (RapidJSON Precise) 0.370±0.010 113.16±00.02 + 128.88±00.06 8.20±00.36
C++/g++ (Boost.JSON) 0.515±0.017 113.21±00.05 + 435.79±00.03 10.49±00.64
C++/clang++ (Boost.JSON) 0.540±0.018 113.21±00.04 + 435.82±00.06 12.07±01.36
C++/g++ (RapidJSON SAX) 0.545±0.020 112.96±00.04 + 0.00±00.00 11.64±00.37
C++/clang++ (RapidJSON SAX) 0.584±0.014 112.98±00.01 + 0.00±00.00 11.64±00.53
C++/g++ (RapidJSON SAX Precise) 0.637±0.024 112.96±00.03 + 0.00±00.00 13.16±00.62
Go (jsoniter) 0.664±0.018 231.16±00.07 + 1.56±00.29 13.45±00.69
C++/clang++ (RapidJSON SAX Precise) 0.704±0.012 113.02±00.02 + 0.00±00.00 15.84±00.52
Java (DSL-JSON) 0.773±0.012 263.56±00.19 + 225.46±10.44 20.15±01.22
Rust (Serde Untyped) 0.791±0.006 111.90±00.11 + 839.98±00.00 18.49±00.42
Python/pypy 0.793±0.006 283.38±00.03 + 123.29±00.00 19.15±00.50
Node.js 0.849±0.008 253.44±00.02 + 79.43±00.41 22.33±00.56
V/gcc 0.857±0.039 111.18±00.02 + 496.21±00.03 18.45±01.93
V/clang 0.857±0.037 111.20±00.02 + 496.21±00.00 18.26±01.80
Julia (JSON3) 0.899±0.009 381.33±00.84 + 369.86±00.60 21.70±01.08
Crystal (Pull) 0.947±0.025 113.79±00.02 + 18.24±00.02 19.54±01.04
Zig 0.953±0.009 111.18±00.03 + 12.18±00.00 22.83±00.59
C#/.NET Core (System.Text.Json) 1.001±0.011 479.24±00.04 + 139.04±00.00 24.33±00.62
Perl (Cpanel::JSON::XS) 1.011±0.038 124.66±00.06 + 402.75±00.03 23.72±00.45
Crystal (Schema) 1.034±0.007 113.81±00.04 + 47.37±00.02 16.49±00.24
Go 1.081±0.019 117.16±00.06 + 83.09±00.14 19.55±00.61
Nim/clang (Packedjson) 1.109±0.027 112.48±00.14 + 294.04±00.13 26.51±01.10
PHP 1.238±0.012 125.00±00.19 + 682.01±00.00 26.76±00.45
Crystal 1.255±0.059 113.80±00.01 + 399.04±00.01 25.29±02.32
Nim/gcc (Packedjson) 1.284±0.064 112.12±00.05 + 293.91±00.00 27.48±02.49
C++/g++ (json-c) 1.500±0.010 113.26±00.11 + 1215.99±00.09 37.11±00.18
C++/clang++ (json-c) 1.573±0.069 113.20±00.10 + 1215.96±00.06 33.92±03.38
Clojure 1.583±0.029 453.73±04.32 + 506.41±07.00 44.71±00.52
Nim/clang 1.656±0.072 112.37±00.05 + 925.03±00.06 35.60±03.51
Go/gccgo 1.674±0.031 137.51±00.09 + 83.45±00.14 30.36±00.83
C#/.NET Core 1.694±0.045 488.52±00.18 + 293.96±00.00 37.22±04.32
Nim/gcc 1.714±0.034 111.90±00.08 + 919.62±00.06 38.51±01.83
CPython (UltraJSON) 1.770±0.036 121.70±00.03 + 549.18±01.21 40.13±00.72
Python 1.841±0.024 120.09±00.02 + 377.21±00.00 38.50±01.67
C++/g++ (Nlohmann) 1.864±0.025 113.19±00.03 + 447.91±00.03 34.90±01.41
C++/clang++ (Nlohmann) 2.049±0.060 113.09±00.16 + 447.94±00.06 47.98±02.62
C#/Mono 2.299±0.013 476.38±00.10 + 0.00±00.00 41.26±00.38
Ruby (YAJL) 2.304±0.047 123.91±00.02 + 283.34±00.00 54.65±00.52
Ruby 2.406±0.032 123.99±00.03 + 410.71±00.02 56.49±00.67
Scala (uPickle) 2.523±0.111 304.10±00.25 + 690.92±53.38 55.24±02.68
Ruby (--jit) 2.597±0.028 124.00±00.03 + 410.85±00.01 50.76±01.05
D/ldc2 2.605±0.046 113.02±00.08 + 680.14±00.02 51.33±02.05
F#/.NET Core (System.Text.Json) 2.647±0.035 485.48±00.06 + 455.40±02.70 47.38±00.44
D/gdc 2.954±0.040 116.83±00.02 + 600.59±00.00 68.72±00.70
Rust (jq) 3.683±0.146 113.80±00.03 + 778.63±00.77 72.59±07.14
Haskell 3.741±0.030 115.81±00.04 + 715.16±00.12 71.95±00.46
Ruby/jruby 4.031±0.122 454.49±01.35 + 1057.26±47.95 98.09±04.16
C++/g++ (Boost.PropertyTree) 4.246±0.161 113.10±00.04 + 1440.12±00.06 88.11±02.27
C++/clang++ (Boost.PropertyTree) 4.479±0.153 113.07±00.02 + 1440.12±00.06 93.73±03.39
D/dmd 5.149±0.109 113.70±00.04 + 680.12±00.03 100.42±03.82
Vala/clang 5.271±0.123 114.60±00.03 + 932.48±00.08 108.70±03.32
Vala/gcc 5.616±0.201 114.55±00.04 + 998.05±00.03 119.13±04.06
Perl (JSON::Tiny) 11.569±0.109 125.21±00.17 + 528.75±00.12 278.19±03.01
Ruby/truffleruby (--jvm) 16.371±0.077 782.39±13.10 + 1618.32±65.18 519.73±02.85
Ruby/truffleruby 22.785±0.967 782.26±02.71 + 1935.10±55.69 533.64±34.13

Matmul

Testing allocating and multiplying matrices.

Matmul

Language Time, s Memory, MiB Energy, J
D/ldc2 (lubeck) 0.077±0.001 6.99±00.06 + 56.20±00.16 4.35±00.12
Python (NumPy) 0.102±0.003 27.86±00.09 + 57.56±00.02 5.88±00.24
Java (ND4J) 0.102±0.004 145.50±00.65 + 90.75±00.04 5.09±00.15
Nim/clang (Arraymancer) 0.107±0.013 6.42±00.05 + 55.80±00.23 5.47±00.74
Nim/gcc (Arraymancer) 0.140±0.014 5.58±00.06 + 55.63±00.30 7.48±00.76
C++/clang++ (Eigen) 0.187±0.001 3.88±00.04 + 85.25±00.00 3.75±00.05
C++/g++ (Eigen) 0.192±0.002 3.87±00.04 + 85.25±00.00 3.90±00.08
Julia (threads: 8) 0.227±0.002 239.76±00.56 + 37.61±00.24 11.96±00.21
Julia (threads: 1) 0.572±0.028 239.99±00.21 + 37.76±00.09 12.56±01.37
Julia (no BLAS) 1.253±0.009 218.35±00.13 + 51.61±00.02 31.79±01.39
D/ldc2 1.959±0.009 3.65±00.04 + 70.13±00.00 44.91±00.90
D/gdc 2.100±0.034 7.08±00.04 + 70.02±00.01 50.67±02.22
D/dmd 2.138±0.032 3.82±00.10 + 70.15±00.01 47.70±00.63
C/gcc 3.257±0.018 2.04±00.02 + 68.06±00.00 76.57±00.63
Nim/gcc 3.363±0.030 2.62±00.04 + 65.74±00.00 78.76±01.61
C/clang 3.395±0.015 2.03±00.02 + 68.06±00.00 71.73±01.44
Rust 3.406±0.015 2.63±00.11 + 68.32±00.00 72.84±01.02
Zig 3.416±0.022 2.14±00.01 + 68.58±00.00 72.97±01.17
Vala/gcc 3.420±0.009 5.71±00.06 + 68.32±00.00 72.58±02.41
Swift 3.425±0.018 7.74±00.04 + 68.96±00.01 72.56±00.36
Java 3.430±0.024 38.93±00.08 + 77.12±00.17 73.65±01.31
Vala/clang 3.443±0.021 5.76±00.07 + 68.32±00.00 66.78±01.18
Nim/clang 3.462±0.029 3.06±00.02 + 66.26±00.00 75.28±00.53
Go/gccgo 3.545±0.036 22.75±00.10 + 73.53±00.16 76.82±00.71
Go 3.552±0.038 3.60±00.04 + 73.23±00.20 82.81±01.32
Scala 3.554±0.032 75.55±00.46 + 141.56±00.24 83.25±00.61
V/gcc 3.721±0.139 1.97±00.06 + 68.84±00.00 83.13±07.86
V/clang 3.838±0.106 2.38±00.15 + 68.71±00.13 78.54±06.42
Crystal 3.857±0.022 4.21±00.02 + 59.74±00.01 78.29±01.78
Node.js 4.013±0.062 37.90±00.06 + 71.76±00.02 74.39±01.63
Kotlin 4.069±0.058 39.69±00.04 + 80.42±00.31 73.95±01.96
Python/pypy 6.519±0.056 64.68±00.10 + 69.15±00.04 121.39±06.90
C#/.NET Core 6.869±0.111 34.07±00.07 + 69.18±00.00 156.48±03.37
C#/Mono 11.581±0.099 20.21±00.04 + 69.02±00.01 199.28±02.02
Ruby/truffleruby 32.387±0.687 688.24±01.27 + 623.19±04.11 686.65±15.77
Ruby/truffleruby (--jvm) 42.831±0.879 664.54±04.51 + 594.68±09.62 1072.60±08.74
Ruby 220.443±9.912 15.21±00.05 + 68.64±00.00 4474.96±226.36
Ruby (--jit) 226.957±2.259 15.23±00.03 + 68.89±00.00 4979.78±158.80
Python 245.013±6.027 10.54±00.04 + 68.58±00.00 4514.15±193.21
Tcl 344.324±5.976 7.16±00.03 + 400.44±00.03 7117.51±516.35
Perl 407.359±2.716 8.97±00.07 + 599.66±00.05 8493.58±94.37
Ruby/jruby 510.916±7.856 255.46±04.21 + 743.22±90.55 11145.56±191.17

Primes

Testing:

  • generating primes using the optimized sieve of Atkin;
  • prefix search for their decimal numbers using Trie data structure.

Primes

Language Time, s Memory, MiB Energy, J
Zig 0.081±0.001 1.82±00.03 + 46.95±00.52 1.64±00.02
C++/g++ 0.182±0.002 3.46±00.04 + 84.79±00.00 3.57±00.09
C++/clang++ 0.195±0.002 3.45±00.05 + 84.80±00.00 3.76±00.12
Java 0.212±0.003 38.16±00.23 + 100.12±01.94 4.06±00.09
Node.js 0.318±0.002 34.64±00.04 + 176.54±01.14 5.61±00.07
Lua/luajit 0.430±0.003 2.44±00.04 + 156.87±00.85 8.23±00.24
Scala 0.456±0.022 75.93±00.18 + 195.62±51.29 9.15±00.40
Python/pypy 0.961±0.022 63.14±00.02 + 251.30±00.12 21.02±00.17
Ruby/truffleruby 1.555±0.009 444.96±01.80 + 484.02±05.14 32.94±00.67
Lua 1.754±0.013 2.23±00.07 + 284.29±00.74 35.91±00.46
Ruby/truffleruby (--jvm) 2.372±0.061 577.30±02.86 + 496.29±46.33 49.55±01.18
Ruby (--jit) 2.575±0.010 14.11±00.04 + 150.19±00.02 54.68±00.98
Ruby 2.696±0.074 14.07±00.05 + 149.89±00.04 46.06±02.25
Ruby/jruby 3.111±0.210 187.63±01.50 + 459.96±27.29 60.96±05.23
Python 5.714±0.175 10.08±00.02 + 236.86±00.62 107.01±08.77

Tests Execution

Environment

CPU: Intel(R) Core(TM) i7-10710U

Base Docker image: Debian GNU/Linux bookworm/sid

Language Version
.NET Core 5.0.402
C#/.NET Core 3.11.0-4.21451.6 (0b1a27fd)
C#/Mono 6.12.0.122
Chez Scheme 9.5.4
Clojure "1.10.3"
Crystal 1.2.1
D/dmd v2.098.0
D/gdc 11.2.0
D/ldc2 1.28.0
Elixir 1.12.2
F#/.NET Core 11.4.2.0 for F# 5.0
Go go1.17.2
Go/gccgo 11.2.0
Haskell 9.0.1
Java 17.0.1
Julia v"1.6.3"
Kotlin 1.5.31
Lua Lua 5.4
Lua/luajit LuaJIT 2.1.0-beta3
MLton 20210117
Nim 1.6.0
Node.js v17.0.1
OCaml 4.11.1
PHP 7.4.21
Perl v5.32.1
Python 3.9.7
Python/pypy 7.3.7-final0 for Python 3.8.12
Racket "8.2"
Ruby 3.0.2p107
Ruby/jruby 9.3.1.0
Ruby/truffleruby 21.3.0
Rust 1.56.0
Scala 3.1.0
Swift swift-5.5.1-RELEASE
Tcl 8.6
V 0.2.4 b72a2de
Vala 0.54.2
Zig 0.8.1
clang/clang++ 11.1.0
gcc/g++ 11.2.0

Using Docker

Build the image:

$ docker build docker/ -t benchmarks

Run the image:

$ docker run -it --rm -v $(pwd):/src benchmarks <cmd>

where is:

  • versions (print installed language versions);
  • shell (start the shell);
  • brainfuck bench (build and run Brainfuck bench.b benchmarks);
  • brainfuck mandel (build and run Brainfuck mandel.b benchmarks);
  • base64 (build and run Base64 benchmarks);
  • json (build and run Json benchmarks);
  • matmul (build and run Matmul benchmarks);
  • primes (build and run Primes benchmarks);

Please note that the actual measurements provided in the project are taken semi-manually (via shell) as the full update takes days and could have occassional issues in Docker.

There is a Makefile that could be used to simplify Docker usage:

  • make build (build the image);
  • make versions (run the image with the versions command);
  • make shell (run the image with the `shell' command);
  • make toc (utility rule to update ToC in this README, requires git-markdown-toc available in PATH).

Please note that the make shell rule requires cpupower utility installed that is invoked with sudo to set cpufreq's performance governon (it runs the CPU at the maximum frequence to eliminate throttling issues).

Manual Execution

Makefiles contain recipes for building and executing tests with the proper dependencies. Please use make run (and make run2 where applicable). The measurements are taken using analyze.rb script:

$ cd <test suite>
$ ../analyze.rb make run
$ ../analyze.rb make run[<single test>]

Please note that the measurements could take hours. It uses 10 iterations by default, but it could be changed using ATTEMPTS environment variable:

$ ATTEMPTS=1 ../analyze.rb make run

Prerequisites

Please use Dockerfile as a reference regarding which packages and tools are required.

For all (optional):

  • Powercap for reading energy counters in Linux (Debian package powercap-utils).

For Python:

  • NumPy for matmul tests (Debian package python3-numpy).
  • UltraJSON for JSON tests (Debian package python3-ujson).

For C++:

  • Boost for JSON tests (Debian package libboost-dev).
  • JSON-C for JSON tests (Debian package libjson-c-dev).

For Rust:

  • libjq for jq test (Debian packages libjq-dev, libonig-dev and environment variable JQ_LIB_DIR=/usr/lib/x86_64-linux-gnu/).

For Java, Scala:

  • Coursier for downloading Maven artifacts.

For Haskell:

  • network for TCP connectivity between the tests and the test runner.
  • raw-strings-qq for raw string literals used in tests.

For Perl:

  • cpanminus for installing modules from CPAN (Debian package cpanminus).

For Vala:

  • JSON-GLib for JSON tests (Debian package libjson-glib-dev).

Contribution

Please follow the criteria specified in the overview. Besides that please ensure that the communication protocol between a test and the test runner is satisfied:

  • The test runner listens on localhost:9001;
  • All messages are sent using TCP sockets closed immediately after the message has been sent;
  • There are two messages sent from a test (it establishes the measurement boundary):
    1. The beginning message having the format name of the test/tprocess ID (the process ID is used to measure the memory consumption). Please note that the name of the test couldn't use Tab character as it's a delimiter;
    2. The end message with any content (mostly it's "stop" for consistency).
  • The test runner could be unavailable (if the test is launched as is) and the test should gracefully handle it.

Makefile guide

Binary executables

If the test is compiled into a single binary, then two sections of the Makefile require changes:

  • append a new target (the final binary location) into executables variable;
  • append the proper target rule.

Compiled artifacts

If the test is compiled, but can't be executed directly as a binary, then three sections of the Makefile require changes:

  • append a new target (the final artifact location) into artifacts variable;
  • append the proper target rule to compile the test;
  • append run[<target_artifact>] rule to run the test.

Scripting language

If the test doesn't require compilation, then two sections of the Makefile requires changes:

  • append run[<script_file>] into all_runners variable;
  • append run[<script_file>] rule to run the test.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].