From: Felix Ableitner <me@nutomic.com>
Date: Thu, 14 Jan 2021 16:51:38 +0000 (+0100)
Subject: Add compilation benchmark, move scripts into subfolder
X-Git-Url: http://these/git/%7B%60/css/themes/static/gitweb.js?a=commitdiff_plain;h=5c198ea85df74790cf3f780f52de12c521395540;p=lemmy.git

Add compilation benchmark, move scripts into subfolder
---

diff --git a/clean.sh b/clean.sh
deleted file mode 100755
index 3666a729..00000000
--- a/clean.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-cargo update
-cargo fmt
-cargo check
-cargo clippy
-cargo outdated -R
diff --git a/scripts/compilation_benchmark.sh b/scripts/compilation_benchmark.sh
new file mode 100755
index 00000000..76003798
--- /dev/null
+++ b/scripts/compilation_benchmark.sh
@@ -0,0 +1,23 @@
+#!/bin/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 +1.47.0 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"
\ No newline at end of file
diff --git a/db-init.sh b/scripts/db-init.sh
similarity index 100%
rename from db-init.sh
rename to scripts/db-init.sh
diff --git a/install.sh b/scripts/install.sh
similarity index 100%
rename from install.sh
rename to scripts/install.sh
diff --git a/query_testing/apache_bench_report.sh b/scripts/query_testing/apache_bench_report.sh
similarity index 100%
rename from query_testing/apache_bench_report.sh
rename to scripts/query_testing/apache_bench_report.sh
diff --git a/query_testing/api_benchmark.sh b/scripts/query_testing/api_benchmark.sh
similarity index 100%
rename from query_testing/api_benchmark.sh
rename to scripts/query_testing/api_benchmark.sh
diff --git a/query_testing/views_old/generate_reports.sh b/scripts/query_testing/views_old/generate_reports.sh
similarity index 100%
rename from query_testing/views_old/generate_reports.sh
rename to scripts/query_testing/views_old/generate_reports.sh
diff --git a/query_testing/views_old/timings-2021-01-05_21-06-37.out b/scripts/query_testing/views_old/timings-2021-01-05_21-06-37.out
similarity index 100%
rename from query_testing/views_old/timings-2021-01-05_21-06-37.out
rename to scripts/query_testing/views_old/timings-2021-01-05_21-06-37.out
diff --git a/query_testing/views_to_diesel_migration/generate_reports.sh b/scripts/query_testing/views_to_diesel_migration/generate_reports.sh
similarity index 100%
rename from query_testing/views_to_diesel_migration/generate_reports.sh
rename to scripts/query_testing/views_to_diesel_migration/generate_reports.sh
diff --git a/query_testing/views_to_diesel_migration/timings-2021-01-05_21-32-54.out b/scripts/query_testing/views_to_diesel_migration/timings-2021-01-05_21-32-54.out
similarity index 100%
rename from query_testing/views_to_diesel_migration/timings-2021-01-05_21-32-54.out
rename to scripts/query_testing/views_to_diesel_migration/timings-2021-01-05_21-32-54.out
diff --git a/test.sh b/scripts/test.sh
similarity index 100%
rename from test.sh
rename to scripts/test.sh