|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | 3 | # Time on page with 10k lines |
4 | | -tr -dc "A-Za-z 0-9" < /dev/urandom | fold -w100|head -n 100000 > scripts/benchmark/sample_project/docs/bigpage.md |
5 | | - |
6 | | -echo "running mkdocs build.." |
7 | | -# Start the timer |
8 | | -start_time=$(date +%s) |
| 4 | +tr -dc "A-Za-z 0-9" < /dev/urandom | fold -w100|head -n 1000000 > scripts/benchmark/sample_project/docs/bigpage.md |
| 5 | +size=$(ls -lh scripts/benchmark/sample_project/docs/bigpage.md | awk '{print $5}') |
9 | 6 |
|
10 | | -# Time this command |
11 | | -mkdocs build -f scripts/benchmark/sample_project/mkdocs.yml |
12 | 7 |
|
13 | | -# Calculate the elapsed time |
14 | | -end_time=$(date +%s) |
15 | | -elapsed_time=$((end_time - start_time)) |
| 8 | +function build_mkdocs { |
| 9 | + local mkdocs_config_file="$1" |
16 | 10 |
|
17 | | -# Calculate minutes and seconds |
18 | | -minutes=$((elapsed_time / 60)) |
19 | | -seconds=$((elapsed_time % 60)) |
| 11 | + echo "Building: $mkdocs_config_file" |
| 12 | + # Start the timer |
| 13 | + start_time=$(date +%s) |
| 14 | + mkdocs build -q -f "$mkdocs_config_file" |
| 15 | + end_time=$(date +%s) |
| 16 | + elapsed_time=$((end_time - start_time)) |
| 17 | + minutes=$((elapsed_time / 60)) |
| 18 | + seconds=$((elapsed_time % 60)) |
| 19 | + formatted_time="${minutes} mins ${seconds} secs" |
20 | 20 |
|
21 | | -# Format the time as X mins Y secs |
22 | | -formatted_time="${minutes} mins ${seconds} secs" |
| 21 | + echo "Built $mkdocs_config_file, using a page with size $size. Elapsed time: $formatted_time" |
| 22 | +} |
23 | 23 |
|
24 | | -# Write the formatted time to a text file |
25 | | -# echo "Elapsed Time: $formatted_time" > scripts/time_report.txt |
| 24 | +mkdocs_config_file="scripts/benchmark/sample_project/mkdocs.yml" |
| 25 | +build_mkdocs "$mkdocs_config_file" |
26 | 26 |
|
| 27 | +mkdocs_config_file="scripts/benchmark/sample_project/mkdocs_no_tablereader.yml" |
| 28 | +build_mkdocs "$mkdocs_config_file" |
27 | 29 |
|
28 | | -size=$(ls -lh scripts/benchmark/sample_project/docs/bigpage.md | awk '{print $5}') |
| 30 | +mkdocs_config_file="scripts/benchmark/sample_project/mkdocs_superfences.yml" |
| 31 | +build_mkdocs "$mkdocs_config_file" |
29 | 32 |
|
30 | | -echo "Mkdocs build completed, using a page with size $size. Elapsed time: $formatted_time" |
|
0 commit comments