Last active
November 17, 2022 08:40
-
-
Save zekroTJA/323bc7012c49914b95446b4cd7bd9a18 to your computer and use it in GitHub Desktop.
Revisions
-
zekroTJA revised this gist
Nov 17, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ #!/bin/bash # Example Results: https://docs.google.com/spreadsheets/d/1wYMqYTVqrG2nG9ZcBTJFxFwT4VC2Fg5GmGEhmQoP8Ns/edit?usp=sharing GO_CODE="package main import \"fmt\" func main() { -
zekroTJA revised this gist
Nov 17, 2022 . No changes.There are no files selected for viewing
-
zekroTJA created this gist
Nov 17, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ #!/bin/bash GO_CODE="package main import \"fmt\" func main() { fmt.Println(\"Hello world!\") }" RUST_CODE="fn main() { println!(\"Hello world!\"); }" GO_IMAGE="golang:alpine" RUST_IMAGE="rust:alpine" N_RUNS=$1 [ -z $N_RUNS ] && echo "Please specify the number of runs!" && exit 1 rm results_* || true echo "$GO_CODE" > main.go for i in $(seq 0 $(($N_RUNS - 1))); do echo "Go - Run #${i}" OUT=$(docker run --rm -v $(pwd)/main.go:/var/code/main.go:ro $GO_IMAGE time go build /var/code/main.go 2>&1 > /dev/null) TIME=$(echo "${OUT}" | head -n 1 | cut -f2) echo "$i,$TIME" >> results_go.csv done rm main.go echo "$RUST_CODE" > main.rs for i in $(seq 0 $(($N_RUNS - 1))); do echo "Rust - Run #${i}" OUT=$(docker run --rm -v $(pwd)/main.rs:/var/code/main.rs:ro $RUST_IMAGE time rustc -O /var/code/main.rs 2>&1 > /dev/null) TIME=$(echo "${OUT}" | head -n 1 | cut -f2) echo "$i,$TIME" >> results_rust.csv done rm main.rs