Skip to content

Benchmarks and speed improvements#38

Merged
zmre merged 6 commits intomainfrom
2026-02-08-benchmarks
Feb 17, 2026
Merged

Benchmarks and speed improvements#38
zmre merged 6 commits intomainfrom
2026-02-08-benchmarks

Conversation

@zmre
Copy link
Owner

@zmre zmre commented Feb 13, 2026

No description provided.

zmre added 5 commits February 8, 2026 22:05
Optimize sorting, markdown rendering, and path resolution performance

Apply Schwartzian transform to sorting (6x faster multi-field sort by pre-extracting keys), merge two markdown parse passes into one (20% faster renders), eliminate YAML tree cloning in frontmatter parsing, use minimal parser options for H1 extraction, and cache canonical base dir to avoid per-request canonicalize() syscalls (40% faster path resolution).

Benchmark Improvements vs Baseline

|               Benchmark                |  Before  |  After  |     Improvement      |
|----------------------------------------|----------|---------|----------------------|
| sort_multi_field/2000                  | 10.78 ms | 1.75 ms | -83.8% (6.1x faster) |
| sort_multi_field/500                   | 1.76 ms  | 387 us  | -78.0% (4.5x faster) |
| sort_multi_field/100                   | 192 us   | 68 us   | -64.7% (2.8x faster) |
| sort_single_field/2000                 | 1.09 ms  | 1.01 ms | -6.2%                |
| sort_single_field/500                  | 269 us   | 248 us  | -7.5%                |
| markdown_render/large                  | 576 us   | 453 us  | -21.3%               |
| markdown_render/medium                 | 114 us   | 91 us   | -20.0%               |
| markdown_render/small                  | 22.5 us  | 20.4 us | -9.4%                |
| extract_first_h1/large                 | 80.3 us  | 69.8 us | -12.7%               |
| extract_first_h1/small                 | 1.37 us  | 1.30 us | -5.4%                |
| path_resolver/markdown_file            | 17.4 us  | 10.6 us | -39.0%               |
| path_resolver/static_file              | 17.5 us  | 10.5 us | -39.9%               |
| path_resolver/directory_trailing_slash | 38.5 us  | 31.1 us | -19.0%               |
| path_resolver/not_found                | 39.1 us  | 32.5 us | -16.9%               |
| path_resolver/path_traversal           | 39.8 us  | 32.3 us | -18.3%               |
@zmre
Copy link
Owner Author

zmre commented Feb 13, 2026

Was going to wait for the next release of pagefind (1.5.0 or the next beta of it), but giving up. Too many good speedups to hold this back more.

@zmre zmre merged commit 07da080 into main Feb 17, 2026
16 checks passed
@zmre zmre deleted the 2026-02-08-benchmarks branch February 17, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant