Files
lemmy/scripts/compilation_benchmark.sh
Dessalines 9ccd647e02 Fixing docker_update.sh script to not add context. (#5820)
* Fixing docker_update.sh script to not add context.

Use docker build from a higher level to not load massive context.

* Adding a custom postgresql for testing.

* Fixing docker update

* Fixing dir.

* Fix rust log

* Add bash / shell file format checking.

* Adding shfmt package.

* Running bash format.

* Fixing bash fmt.

* Fixing bash fmt 2.

* Adding pgtune note.
2025-06-26 09:48:39 +02:00

24 lines
668 B
Bash
Executable File

#!/usr/bin/env bash
set -e
times=3
duration=0
for ((i = 0; i < times; i++)); do
echo "Starting iteration $i"
echo "cargo clean"
# to benchmark incremental compilation time, do a full build with the same compiler version first,
# and use the following clean command:
cargo clean -p lemmy_utils
#cargo clean
echo "cargo build"
start=$(date +%s.%N)
RUSTC_WRAPPER='' cargo build -q
end=$(date +%s.%N)
echo "Finished iteration $i after $(bc <<<"scale=0; $end - $start") seconds"
duration=$(bc <<<"$duration + $end - $start")
done
average=$(bc <<<"scale=0; $duration / $times")
echo "Average compilation time over $times runs is $average seconds"