-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[llvm] Add benchmarks for Mustache #160164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok, though I'm not familiar enough with mustache to know if benchmarking these things in particular makes sense.
4404c23
to
0683179
Compare
Merge activity
|
686efa6
to
e8a973d
Compare
e8a973d
to
2d7f1b9
Compare
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.
2d7f1b9
to
47a5f24
Compare
Note the premerge failure was due to an existing lldb test failure, and unrelated to this patch. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/16618 Here is the relevant piece of the build log for the reference
|
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.
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:
template.
keys.
5k-iteration loop inside the template.
(50 levels).
array.
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.