mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
Fix the compare script of the benchmarks
This commit is contained in:
parent
a32236c80c
commit
76a2343639
@ -11,9 +11,9 @@
|
|||||||
# Checking that critcmp is installed
|
# Checking that critcmp is installed
|
||||||
command -v critcmp > /dev/null 2>&1
|
command -v critcmp > /dev/null 2>&1
|
||||||
if [[ "$?" -ne 0 ]]; then
|
if [[ "$?" -ne 0 ]]; then
|
||||||
echo 'You must install critcmp to make this script working.'
|
echo 'You must install critcmp to make this script work.'
|
||||||
echo '$ cargo install critcmp'
|
|
||||||
echo 'See: https://github.com/BurntSushi/critcmp'
|
echo 'See: https://github.com/BurntSushi/critcmp'
|
||||||
|
echo ' $ cargo install critcmp'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -21,38 +21,30 @@ if [[ $# -ne 2 ]]
|
|||||||
then
|
then
|
||||||
echo 'Need 2 arguments.'
|
echo 'Need 2 arguments.'
|
||||||
echo 'Usage: '
|
echo 'Usage: '
|
||||||
echo ' $ ./compare.sh file_to_download1 file_to_download2'
|
echo ' $ ./compare.sh old new'
|
||||||
echo 'Ex:'
|
echo 'Ex:'
|
||||||
echo ' $ ./compare.sh songs_main_09a4321.json songs_geosearch_24ec456.json'
|
echo ' $ ./compare.sh songs_main_09a4321.json songs_geosearch_24ec456.json'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
file1="$1"
|
old_file="$1"
|
||||||
file2="$2"
|
new_file="$2"
|
||||||
s3_url='https://milli-benchmarks.fra1.digitaloceanspaces.com/critcmp_results'
|
s3_url='https://milli-benchmarks.fra1.digitaloceanspaces.com/critcmp_results'
|
||||||
file1_s3_url="$s3_url/$file1"
|
|
||||||
file2_s3_url="$s3_url/$file2"
|
|
||||||
file1_local_path="/tmp/$file1"
|
|
||||||
file2_local_path="/tmp/$file2"
|
|
||||||
|
|
||||||
if [[ ! -f "$file1_local_path" ]]; then
|
for file in $old_file $new_file
|
||||||
curl "$file1_s3_url" -O "$file1_local_path"
|
do
|
||||||
if [[ "$?" -ne 0 ]]; then
|
file_s3_url="$s3_url/$file"
|
||||||
echo 'curl command failed.'
|
file_local_path="/tmp/$file"
|
||||||
exit 1
|
|
||||||
|
if [[ ! -f $file_local_path ]]; then
|
||||||
|
curl $file_s3_url --output $file_local_path --silent
|
||||||
|
if [[ "$?" -ne 0 ]]; then
|
||||||
|
echo 'curl command failed.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
echo "$file1 already present in /tmp, no need to download."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f "$file2_local_path" ]]; then
|
# Print the diff changes between the old and new benchmarks
|
||||||
curl "$file2_s3_url" -O "$file2_local_path"
|
# by only displaying the lines that have a diff of more than 5%.
|
||||||
if [[ "$?" -ne 0 ]]; then
|
critcmp --threshold 5 "/tmp/$old_file" "/tmp/$new_file"
|
||||||
echo 'curl command failed.'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "$file2 already present in /tmp, no need to download."
|
|
||||||
fi
|
|
||||||
|
|
||||||
critcmp --color always "$file1_local_path" "$file2_local_path"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user