From 5c198ea85df74790cf3f780f52de12c521395540 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 14 Jan 2021 17:51:38 +0100 Subject: [PATCH] Add compilation benchmark, move scripts into subfolder --- clean.sh | 7 ------ scripts/compilation_benchmark.sh | 23 +++++++++++++++++++ db-init.sh => scripts/db-init.sh | 0 install.sh => scripts/install.sh | 0 .../query_testing}/apache_bench_report.sh | 0 .../query_testing}/api_benchmark.sh | 0 .../views_old/generate_reports.sh | 0 .../views_old/timings-2021-01-05_21-06-37.out | 0 .../generate_reports.sh | 0 .../timings-2021-01-05_21-32-54.out | 0 test.sh => scripts/test.sh | 0 11 files changed, 23 insertions(+), 7 deletions(-) delete mode 100755 clean.sh create mode 100755 scripts/compilation_benchmark.sh rename db-init.sh => scripts/db-init.sh (100%) rename install.sh => scripts/install.sh (100%) rename {query_testing => scripts/query_testing}/apache_bench_report.sh (100%) rename {query_testing => scripts/query_testing}/api_benchmark.sh (100%) rename {query_testing => scripts/query_testing}/views_old/generate_reports.sh (100%) rename {query_testing => scripts/query_testing}/views_old/timings-2021-01-05_21-06-37.out (100%) rename {query_testing => scripts/query_testing}/views_to_diesel_migration/generate_reports.sh (100%) rename {query_testing => scripts/query_testing}/views_to_diesel_migration/timings-2021-01-05_21-32-54.out (100%) rename test.sh => scripts/test.sh (100%) 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 -- 2.44.1