mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-30 20:00:33 +00:00
4e5798852f
Previously, these scripts wouldn't work on exotic systems such as NixOS. ``` fd '\.sh$' -t f --exec sed -i 's@#!/bin/bash@#!/usr/bin/env bash@' ```
23 lines
694 B
Bash
Executable file
23 lines
694 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"
|