blob: 36ba42327050fa49d91301c7abc7047214136971 (
plain)
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
|
#!/usr/bin/bash
# Compile
gcc test.c -o testc -O2 -march=native # C
g++ test.cpp -o testcpp -O2 -march=native # C++
python -m py_compile test.py # Python
javac test.java # Java
mcs test.cs # C#
go build -o testgo test.go # Go
rustc test.rs -C opt-level=2 -C target-cpu=native -o testrs # Rust
ghc -dynamic -O test.hs -o tesths # Haskell
# Run benchmarks
run=('./testc' # C
'./testcpp' # C++
'python test.py' # Python
'java test' # Java
'mono test.exe' # C#
'node test.js' # Node
'perl test.pl' # Perl
'ruby test.rb' # Ruby
'./testgo' # Go
'./testrs' # Rust
'./tesths' # Haskell
'julia test.jl' # Julia
'Rscript test.r' # R
'ecl --shell test.lisp' # Common Lisp
'lua test.lua' # Lua
'elixir test.exs' # Elixir
)
echo ${run[@]@Q} | xargs hyperfine --export-json data.json
# Cleanup
rm testc testcpp test.class test.exe testgo testrs tesths test.o test.hi
rm __pycache__ -r
|