[all-commits] [llvm/llvm-project] 686efa: [llvm] Add benchmarks for Mustache
Paul Kirth via All-commits
all-commits at lists.llvm.org
Thu Sep 25 16:22:31 PDT 2025
Branch: refs/heads/users/ilovepi/mustache-bench
Home: https://github.com/llvm/llvm-project
Commit: 686efa6ab6e8932e68ea38276e98aab03de41ae6
https://github.com/llvm/llvm-project/commit/686efa6ab6e8932e68ea38276e98aab03de41ae6
Author: Paul Kirth <pk1574 at gmail.com>
Date: 2025-09-25 (Thu, 25 Sep 2025)
Changed paths:
M llvm/benchmarks/CMakeLists.txt
A llvm/benchmarks/Mustache.cpp
Log Message:
-----------
[llvm] Add benchmarks for Mustache
The mustache library still has many issues with performance. While not
critical, template rendering is fairly simple, and should be fast. This
is hard to reason about without a benchmark. Since there is no standard
benchmark suite for Mustache, we can construct some benchmarks that will
stress our implementation.
This commit adds a new benchmark suite (MustacheBench) that tests several
key performance areas:
- Parsing (Complex): Measures the one-time parse cost of a large
template.
- Parsing (Small): Measures the parse cost of a small template with deep
keys.
- Data Traversal: Stresses hot, cached data traversal using a
5k-iteration loop inside the template.
- Context Stack: Tests the render cost of deeply nested sections
(50 levels).
- Array Iteration: Benchmarks section iteration over a 100,000-item
array.
- Partial Rendering: Tests partial tag performance inside a large loop.
- String Escaping: Measures HTML-escaping a large string.
- String Unescaped (Triple): Baseline for {{{...}}} syntax.
- String Unescaped (Ampersand): Baseline for {{& ...}} syntax.
- Output Buffer: Tests rendering a single 1MB string.
Initial results show that Partial rendering is by far the slowest
operation. The cost per-item is ~3x higher than simple iteration,
because partial templates are being re-parsed on every call instead of
being cached. It also shows that the logic for HTML escaping is very
expensive likely due to the character by character parsing done to
escapes.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list