From 664948d1b0ec6af51eb49145ca50965fe4f76816 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 11 Sep 2023 21:44:22 +0300 Subject: [PATCH] provide helper script for benchmarking --- prepare.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 prepare.sh diff --git a/prepare.sh b/prepare.sh new file mode 100755 index 0000000..adbb485 --- /dev/null +++ b/prepare.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +mkdir -p bin/ + +root_dir=$(pwd) + +# 1. Build and copy Go binary +echo "Building and copying Go binary..." +cd go/ +go build -ldflags="-s -w" -o ../bin/tinierfetch-go main.go +cd $root_dir + +# 2. Build and copy Rust binary +echo "Building and copying Rust binary..." +cd rs/ +cargo build --release +cp target/release/tinierfetch-rs ../bin/ -vf +cd $root_dir + +# 3. Build and copy C++ binaries +echo "Building and copying C++ binaries..." +cd cpp/ +make clean && make all && +cp fetch_size fetch_speed ../bin/ -vf +cd $root_dir + +# 4. Display binary sizes +echo "Binary Sizes:" +ls -lh bin/* + +# 5. Benchmark binary speeds +echo "Benchmarking binary speeds..." +hyperfine -N --warmup 10000 'bin/tinierfetch-go' 'bin/tinierfetch-rs' 'bin/tinierfetch-cpp-size' 'bin/tinierfetch-cpp-speed' --export-markdown markdown.md +