Skip to content

Commit 781fc82

Browse files
authored
update benchmark
1 parent 931acb8 commit 781fc82

File tree

3 files changed

+43
-19
lines changed

3 files changed

+43
-19
lines changed

scripts/benchmark/benchmark.sh

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
#!/bin/bash
22

33
# 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}')
96

10-
# Time this command
11-
mkdocs build -f scripts/benchmark/sample_project/mkdocs.yml
127

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"
1610

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"
2020

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+
}
2323

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"
2626

27+
mkdocs_config_file="scripts/benchmark/sample_project/mkdocs_no_tablereader.yml"
28+
build_mkdocs "$mkdocs_config_file"
2729

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"
2932

30-
echo "Mkdocs build completed, using a page with size $size. Elapsed time: $formatted_time"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
site_name: test git_table_reader site
2+
use_directory_urls: false
3+
4+
plugins:
5+
- search
6+
7+
nav:
8+
- index.md
9+
- bigpage.md
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
site_name: test git_table_reader site
2+
use_directory_urls: false
3+
4+
plugins:
5+
- search
6+
7+
nav:
8+
- index.md
9+
- bigpage.md
10+
11+
12+
markdown_extensions:
13+
- pymdownx.superfences

0 commit comments

Comments
 (0)