Conversation
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% |
Owner
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.