diff options
author | Anthony Wang | 2021-12-08 12:32:19 -0600 |
---|---|---|
committer | Anthony Wang | 2021-12-08 12:32:19 -0600 |
commit | e339bd98fd86a875bf797106349ee312773b60b3 (patch) | |
tree | 085279be15ebd6937a285a478b7c2ccc61ebdb5f | |
parent | 59698d61ab48784d33798a7c8a32daee17940380 (diff) |
Add run script
-rwxr-xr-x | run.sh | 62 | ||||
-rw-r--r-- | test.c | 2 | ||||
-rw-r--r-- | test.hs | 2 |
3 files changed, 65 insertions, 1 deletions
@@ -0,0 +1,62 @@ +#!/usr/bin/bash + +echo C +gcc test.c -o test -O2 -march=native +hyperfine ./test +rm test + +echo C++ +g++ test.cpp -o test -O2 -march=native +hyperfine ./test +rm test + +echo Python +python -m py_compile test.py +hyperfine "python test.py" +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 + @@ -2,7 +2,7 @@ #include <stdio.h> -inline int gcd(int a, int b) +int gcd(int a, int b) { if (b > 0) return gcd(b, a % b); else return a; @@ -1,5 +1,7 @@ -- Haskell +import Prelude hiding (gcd) + gcd :: Integer -> Integer -> Integer gcd a b = if b > 0 then gcd b (mod a b) else a |