Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/11ty/eleventy-benchmark
Eleventy Benchmark Speed Regression Test
https://github.com/11ty/eleventy-benchmark
eleventy
Last synced: about 7 hours ago
JSON representation
Eleventy Benchmark Speed Regression Test
- Host: GitHub
- URL: https://github.com/11ty/eleventy-benchmark
- Owner: 11ty
- Created: 2018-12-25T05:42:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-18T22:02:22.000Z (4 months ago)
- Last Synced: 2024-10-29T15:44:51.001Z (3 months ago)
- Topics: eleventy
- Language: HTML
- Size: 22.5 KB
- Stars: 9
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Eleventy Benchmark Speed Regression Test
Creates 1000 (Liquid|Nunjucks|Markdown) templates. Runs Eleventy against each template format individually and measures the Median Eleventy Runtime (over 10 runs) and Median Time Spent Per Template.
Can optionally run serially against multiple Eleventy versions, for comparison.
Eleventy features:
* Each individual template uses:
- A layout file (of the same template type).
- A tag to make it part of a collection
- Front matter data used in the template content body
- Markdown files are preprocessed by Liquid (as is Eleventy default)
- Templates are not tiny—they use content and the output HTML is about 10KB.
* Template types have one index page template that lists all the templates in a custom sorted collection based on a front matter value.## Usage
```sh
$ ./bench.sh
```Requires the `datamash` utility (`brew install datamash` on Mac OS using homebrew). Uh, and all the prerequisites for Eleventy.
### Use with Speedscope
This benchmark uses Node’s --cpu-prof arg to create a `.cpuprofile` output that can be uploaded to [speedscope.app](https://www.speedscope.app/) for further review.
### Sample Output
```
~/Code/eleventy-bench ᐅ ./bench.sh
---------------------------------------------------------
Eleventy Benchmark (Node v10.14.2, 1000 templates each)
---------------------------------------------------------
Eleventy 0.5.4
---------------------------------------------------------
.liquid: .......... 10 runs.
* Median: 1.62 seconds
* Median per template: 1 ms.njk: .......... 10 runs.
* Median: 2.775 seconds
* Median per template: 2 ms.md: .......... 10 runs.
* Median: 2.915 seconds
* Median per template: 2 ms---------------------------------------------------------
Eleventy 0.6.0
---------------------------------------------------------
.liquid: .......... 10 runs.
* Median: 1.755 seconds (8%)
* Median per template: 1 ms (0%).njk: .......... 10 runs.
* Median: 2.885 seconds (3%)
* Median per template: 2 ms (0%).md: .......... 10 runs.
* Median: 2.95 seconds (1%)
* Median per template: 2 ms (0%)
```### Steps to add additional template type
1. See `make-liquid-files.sh` as a template script to generate a bunch of sample files for a template type.
2. Add the template language key to `bench.sh`
3. Add `$key/page` to the `.gitignore` file.
4. Create a layout file in `_includes`
5. Create an index page that loops over all items in the collection at `$key/`