36 lines
1.8 KiB
Bash
Executable file
36 lines
1.8 KiB
Bash
Executable file
#!/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
|