Performance
On this page
网站性能
Eleventy 允许你完全控制输出的内容。也就意味着,默认情况下,我们不打包输出任何降低性能的 JavaScript 运行时!
Have a look at our new Partial Hydration
<is-land> component!Eleventy 排行榜 上列出的所有网站基本上每个月都会进行测试和排名,作为一个有趣的社区活动,以促进 Eleventy 网站的性能。
- 想 把你的网站添加到排行榜 吗?
Looking for guidance on single page applications (SPA)?
编译性能
Eleventy offers best-in-class build performance for JavaScript site generators.
| Name | Building ×4000 Markdown Files | |
|---|---|---|
| Hugo | 0.68s | = 🏁 |
| Eleventy | 1.93s | == 🏁 |
| Astro | 22.90s | ======================= 🏁 |
| Gatsby | 29.05s | ============================== 🏁 |
| Next.js | 70.65s | ======================================================================= 🏁 |
Data taken from Which Generator Builds Markdown the Fastest? (July 2022).
Performance Tips
- You can analyze your project’s specific build performance metrics (via DEBUG or Node.js CPU Profiling).
- Memoize costly Shortcodes and Filters (we typically see the most expensive ones are those performing JavaScript, CSS, or HTML minification)
- Take passthrough copy out of your build-loop with the Eleventy Dev Server.
- Use the Image HTML Transform method to optimize images on-request during development.
- Use
--incrementalfor Incremental builds. - Use the Directory Output plugin to report per-template performance and file size information.
- Making network requests (to an API) can be expensive! Use the Fetch utility to create a local cache of external network requests (use
durationto configure how long the cache should last).
Installation Performance
| Tool | node_Weight |
npm installTime |
|
|---|---|---|---|
| Eleventy | 34 MB |
5.81s |
====== 🏁 |
| SvelteKit | 111 MB |
6.78s |
======= 🏁 |
| Next.js | 158 MB |
3.72s |
==== 🏁 |
| Astro | 169 MB |
12.52s |
============= 🏁 |
| Nuxt | 164 MB |
14.77s |
=============== 🏁 |
| Remix | 497 MB |
40.14s |
========================================= 🏁 |
| Gatsby | 583 MB |
43.36s |
============================================ 🏁 |
Data taken from The JavaScript Site Generator Review, 2023 (February 2023).
