Skip to content

Commit e008050

Browse files
committed
Benchmark should always clear out template files at the beginning. Also swaps to ns for per-template measurement so we don’t get a divide by zero (apparently this is too fast now??)
1 parent 405bd1c commit e008050

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

bench.sh

+9-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ RUNS=3
66
#VERSIONS=("file:../eleventy")
77
VERSIONS=("@11ty/eleventy@0.12.1" "@11ty/eleventy@1.0.0")
88

9-
# LANGS=("liquid" "njk" "md" "11ty.js")
10-
LANGS=("liquid" "njk" "md")
9+
ALL_LANGS=("liquid" "njk" "md" "11ty.js")
10+
LANGS=("njk")
11+
12+
for (( i=0; i<${#ALL_LANGS[@]}; i++ )); do
13+
echo "* Deleting previous ${ALL_LANGS[$i]} template files."
14+
rm -rf "${ALL_LANGS[$i]}/page/"
15+
done
1116

1217

1318
LINESEP="---------------------------------------------------------"
@@ -34,7 +39,6 @@ for npmVersion in "${VERSIONS[@]}"; do
3439
RESULTS+=("")
3540
fi
3641

37-
rm -rf "${LANGS[$i]}/page/"
3842
printf "Creating template files…\r"
3943
./make-${LANGS[$i]}-files.sh $TEMPLATE_FILES
4044
printf " \r"
@@ -64,7 +68,7 @@ for npmVersion in "${VERSIONS[@]}"; do
6468

6569
printf " $RUNS runs.\n"
6670
median=`printf $TIMES | datamash median 1`
67-
perTemplate=`echo "$median * 1000 / $TEMPLATE_FILES" | bc`
71+
perTemplate=`echo "$median * 1000000 / $TEMPLATE_FILES" | bc`
6872

6973
printf "* Median: $median seconds"
7074
if [[ ${#BASELINEMEDIAN[@]} < $i+1 ]]; then
@@ -75,7 +79,7 @@ for npmVersion in "${VERSIONS[@]}"; do
7579
echo " (${baselineCompare}%)"
7680
fi
7781

78-
printf "* Median per template: $perTemplate ms"
82+
printf "* Median per template: $perTemplate ns"
7983
if [[ ${#BASELINEPERTEMPLATE[@]} < $i+1 ]]; then
8084
BASELINEPERTEMPLATE+=($perTemplate)
8185
echo ""

0 commit comments

Comments
 (0)