Basic-benchmark-experiment/www/scripts/full-benchmark.sh

77 lines
2.3 KiB
Bash
Raw Permalink Normal View History

2024-03-11 12:43:52 +02:00
#!/bin/bash
# prepare
TEMP_FILE=$(uuid)
touch $TEMP_FILE
cd /home/shared-space-1/presentation/code/
# C
printf -- "--- C ---\n" >> $TEMP_FILE
cd C
pwd
make compile
printf "Unoptimised:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
(time ./code_unoptimised) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
printf "Cycle:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
(time ./code_cycle) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
make clean &> /dev/null
cd ..
# Go
### empty, needs compiler
# Java
printf -- "--- Java ---\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
cd Java
pwd
make compile
printf "Unoptimised:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
(time java code_unoptimised) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
printf "Cycle:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
(time java code_cycle) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
make clean &> /dev/null
cd ..
# JavaScript
printf -- "--- JavaScript ---\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
cd JavaScript
printf "Unoptimised:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
(time node code_unoptimised.js) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
printf "Cycle:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
(time node code_cycle.js) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
cd ..
# Kotlin
printf -- "--- Kotlin ---\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE
# send
cd /home/shared-space-1/presentation/code/www/scripts/
RESULT_STRING=$(cat $TEMP_FILE)
printf -- "Content-Type: text/plain\r\n\r\n%s" "$RESULT_STRING"
rm $TEMP_FILE