Add section for performance tips

This commit is contained in:
wrapperup 2023-06-28 02:28:04 -04:00 committed by Dirkjan Ochtman
parent cc7b9796d8
commit f3d619bacf
2 changed files with 17 additions and 0 deletions

View File

@ -8,3 +8,4 @@
- [Template syntax](./template_syntax.md)
- [Filters](./filters.md)
- [Integrations](./integrations.md)
- [Performance](./performance.md)

16
book/src/performance.md Normal file
View File

@ -0,0 +1,16 @@
# Performance
## Slow Debug Recompilations
If you experience slow compile times when iterating with lots of templates,
you can compile Askama's derive macros with a higher optimization level.
This can speed up recompilation times dramatically.
Add the following to `Cargo.toml` or `.cargo/config.toml`:
```rust
[profile.dev.package.askama_derive]
opt-level = 3
```
This may affect clean compile times in debug mode, but incremental compiles
will be faster.