Rust library to generate static websites
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf: update benchmarks

Princesseuh 5e5347cb 785519be

+28 -16
-1
Cargo.lock
··· 2543 2543 version = "0.1.0" 2544 2544 dependencies = [ 2545 2545 "codspeed-divan-compat", 2546 - "maud", 2547 2546 "maudit", 2548 2547 ] 2549 2548
-1
benchmarks/md-benchmark/Cargo.toml
··· 6 6 7 7 [dependencies] 8 8 maudit = { workspace = true } 9 - maud = { workspace = true } 10 9 11 10 [dev-dependencies] 12 11 divan = { version = "3.0.5", package = "codspeed-divan-compat" }
+7 -7
benchmarks/md-benchmark/README.md
··· 1 1 # md-benchmark 2 2 3 - This crate contains a Maudit website with presets of various amount of markdown files and is used to benchmark the performance of Maudit. 3 + This crate contains a Maudit website with presets of various amount of markdown files and is used to benchmark the performance of Maudit's Markdown rendering. 4 4 5 5 The generated Markdown files were taken from https://github.com/zachleat/bench-framework-markdown. Thanks to Zach Leatherman for providing the benchmark data and comparaison points with other static site generators. 6 6 ··· 32 32 33 33 ## Results 34 34 35 - The following results were obtained on 2025-01-07 using a MacBook Pro (13-inch, M1, 2020) with 16 GB of RAM: 35 + The following results were obtained on 2025-08-27 using a MacBook Pro (13-inch, M1, 2020) with 16 GB of RAM: 36 36 37 37 | Pages | Full Build Time (ms) | 38 38 | ----- | -------------------- | 39 - | 250 | 55 | 40 - | 500 | 113 | 41 - | 1000 | 253 | 42 - | 2000 | 504 | 43 - | 4000 | 922 | 39 + | 250 | 37 | 40 + | 500 | 75 | 41 + | 1000 | 151 | 42 + | 2000 | 319 | 43 + | 4000 | 676 | 44 44 45 45 These numbers are not scientific and only serve as a rough estimate of the performance of Maudit. Your mileage may vary. 46 46
+18 -2
benchmarks/md-benchmark/benches/build.rs
··· 1 1 use std::env; 2 + use std::fs; 3 + use std::path::Path; 2 4 5 + use divan::Bencher; 3 6 use md_benchmark::build_website; 4 7 5 8 fn main() { ··· 10 13 } 11 14 12 15 #[divan::bench(args = [250, 500, 1000, 2000, 4000], sample_count = 3)] 13 - fn full_build(markdown_count: u32) { 14 - build_website(markdown_count); 16 + fn full_build(bencher: Bencher, markdown_count: u32) { 17 + bencher 18 + .with_inputs(|| { 19 + // Clear dist directory before each sample, otherwise later samples will either be very quick if we don't clean 20 + // or very slow if we do. It's better to measure only the actual work being done. It's also closer to how it'd look like 21 + // on platforms like Netlify or Vercel where the output directory is always cleaned before each build. 22 + let dist_dir = Path::new("dist"); 23 + if dist_dir.exists() { 24 + let _ = fs::remove_dir_all(dist_dir); 25 + } 26 + markdown_count 27 + }) 28 + .bench_values(|markdown_count| { 29 + build_website(markdown_count); 30 + }); 15 31 }
+1 -3
benchmarks/md-benchmark/src/page.rs
··· 1 - use maud::{html, PreEscaped}; 2 1 use maudit::{content::UntypedMarkdownContent, page::prelude::*}; 3 2 4 3 #[route("/[file]")] ··· 26 25 .get_source::<UntypedMarkdownContent>("articles") 27 26 .get_entry(params.file.as_str()); 28 27 29 - let content = PreEscaped(entry.render()); 30 - html!((content)).into() 28 + entry.render().into() 31 29 } 32 30 }
+2 -2
website/content/news/maudit01.md
··· 48 48 49 49 In general, if there's a compromise to be made, we prefer to optimize for developer experience over raw performance. However, we still aim to keep Maudit fast enough for most use cases. 50 50 51 - On a 2020 M1 MacBook Pro, [we've found that the final binary of a Maudit project can build a project with 4000 Markdown files in a little over 900ms](https://github.com/bruits/maudit/tree/main/benchmarks/md-benchmark), which we consider quite reasonable. 51 + On a 2020 M1 MacBook Pro, [we've found that the final binary of a Maudit project can build a project with 4000 Markdown files in around 700ms](https://github.com/bruits/maudit/tree/main/benchmarks/md-benchmark), which we consider quite reasonable. 52 52 53 - [![A graph showing the performance of Maudit building 250, 500, 1000, 2000 and 4000 pages. Respectively, it takes 55ms, 113ms, 253ms, 504ms and 922ms for the build to complete.](/01-performance.png)](https://github.com/bruits/maudit/tree/main/benchmarks/md-benchmark) 53 + [![A graph showing the performance of Maudit building 250, 500, 1000, 2000 and 4000 pages. Respectively, it takes 37ms, 75ms, 151ms, 319ms and 676ms for the build to complete.](/01-performance.png)](https://github.com/bruits/maudit/tree/main/benchmarks/md-benchmark) 54 54 55 55 As we add more features, it's possible that Maudit will become slower, but we'll monitor performance and ensure that, yeah, it's reasonably fast. 56 56
website/static/01-performance.png

This is a binary file and will not be displayed.