Modify run script to run all languages in one line
This commit is contained in:
parent
d27fc7325f
commit
2e79040c6a
86
run.sh
86
run.sh
|
@ -1,62 +1,34 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
echo C
|
||||
gcc test.c -o test -O2 -march=native
|
||||
hyperfine ./test
|
||||
rm test
|
||||
# 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
|
||||
|
||||
echo C++
|
||||
g++ test.cpp -o test -O2 -march=native
|
||||
hyperfine ./test
|
||||
rm test
|
||||
# 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
|
||||
)
|
||||
echo ${run[@]@Q} | xargs hyperfine --export-json data.json
|
||||
|
||||
echo Python
|
||||
python -m py_compile test.py
|
||||
hyperfine "python test.py"
|
||||
# Cleanup
|
||||
rm testc testcpp test.class test.exe testgo testrs tesths test.o test.hi
|
||||
rm __pycache__ -r
|
||||
|
||||
echo Java
|
||||
javac test.java
|
||||
hyperfine "java test"
|
||||
rm test.class
|
||||
|
||||
echo C#
|
||||
mcs test.cs
|
||||
hyperfine "mono test.exe"
|
||||
rm test.exe
|
||||
|
||||
echo JavaScript
|
||||
hyperfine "node test.js"
|
||||
|
||||
echo Perl
|
||||
hyperfine "perl test.pl"
|
||||
|
||||
echo Ruby
|
||||
hyperfine "ruby test.rb"
|
||||
|
||||
echo Go
|
||||
go build test.go
|
||||
hyperfine ./test
|
||||
rm test
|
||||
|
||||
echo Rust
|
||||
rustc test.rs -C opt-level=2 -C target-cpu=native
|
||||
hyperfine ./test
|
||||
rm test
|
||||
|
||||
echo Haskell
|
||||
ghc -dynamic test.hs
|
||||
hyperfine ./test
|
||||
rm test test.o test.hi
|
||||
|
||||
echo Julia
|
||||
hyperfine "julia test.jl"
|
||||
|
||||
echo R
|
||||
hyperfine "Rscript test.r"
|
||||
|
||||
echo Lisp
|
||||
hyperfine "ecl --shell test.lisp"
|
||||
|
||||
echo Lua
|
||||
hyperfine "lua test.lua"
|
||||
|
|
Loading…
Reference in a new issue