News for hackers. Stuff that matters.
Re:Framework Benchmarks Round 19 by littlestymaar on Friday May 29, 2020 @02:15AM (#23346771)
While I agree with your criticism of “cheating” and unnatural tricks that you are not likely to use in production (but it's more a fundamental criticism about this kind of benchmark games than a specific criticism of Actix), I don't really share you view on Askama: unless your templates change a lot (i.e. during initial development) or if you need to be able to change then dynamically in production without downtime, compiled templates like Askama are IMHO the way to go when going to production. You can and should use a interpreted one during initial development, and then switch when you're ready to go live.

An actix-web + Askama user.

Re:Framework Benchmarks Round 19 by Klonoar on Friday May 29, 2020 @03:04PM (#23354187)
Using one during development and one during production is indeed a valid use case, but most people simply don't get anywhere close to that level of need.

Let me be very clear: I like Askama and have submitted pull requests to the project in the past. For a new project where I need templates, I value the speed of reflected changes over compiling more stuff into the binary.

There are also certain classes of problems with Askama that you can avoid with something like Tera - e.g, with Askama, if your global layout relies on a value passed in to the rendering context, you'll need to shove that value on every Template struct.

Furthermore, most people will hit bottlenecks in other areas of their application long before templating becomes the issue (i.e, this was the same in Django-land too - templating via cached compiled Django or Jinja2 templates is almost never an issue). Askama is overkill until you need it.

My recommendation, having built projects with both, is thus: build with Tera initially, and swap out hot paths to Askama down the road as they both use the same syntax (roughly) so it's not too difficult to convert one to the other.

In a perfect world the projects would be merged, and you can use the Tera aspect in dev and get Askama in production for free... but that's easier said than done.