• Skip to main content
  • Skip to footer

Dyspatch

  • Products
      • Overview
      Features
      • No-code email builder
      • Email collaboration
      • SMS builder
      • AMP for Email
      • Template localization
      • Expert services
      • Partners & integrations
      •  
      Find your fit
      • Tools for email Designers
      • Dyspatch for translators
      • Email production for Marketers
      • Resources for email Developers
      Sendwithus Logo
      • Overview
      • Analytics
      • A/B testing
      • Triggered emails
  • Pricing
  • Case studies
  • Resources
    • Blog
    • Free templates
    • Webinars
    • Ebooks, guides, & reports
  • Company
    • About us
    • Careers
    • Contact us
  • Login
    • Dyspatch
    • Sendwithus
Get a demo

Python Templating Performance Showdown: Django vs Jinja

By Veronica Best | August 25, 2014 | Categories: Product
dynamodb blog
⏱ 2 minute read

When we first announced that we would be upgrading our templating language from Django to Jinja, we discussed some of our reasons for doing so. This follow-up provides more depth on the technical details.

We upgraded to Jinja because it’s highly extensible, fast, and easy to sandbox. We also considered Genshi and Mako, but eventually landed on Jinja because, in addition to fulfilling our criteria, Jinja had the advantage of being based on Django. This meant that from the get-go,  it rendered almost all of our Django templates correctly and would require less work to migrate everyone over.

Let’s take a look at some of our performance benchmarks.

A New Challenger Approaches

To measure the performance of Jinja and Django templates, we chose three benchmark parameters. The number of variables contained, the number of items being iterated in a for loop, and a real-world test using actual email templates.

To keep the performance measurements fair between Jinja and Django, the parsed versions of the templates were not cached. So unless otherwise stated, render can be taken to mean parse then render.

When just looking at variables vs render time, it’s easy to see that Django seems to have a clear advantage. For most real-world templates, there will be far fewer than fifty rendered variables, but it’s still interesting to see how much faster Jinja’s performance decreases as this number increases.

In this test, we see that Jinja uses about six megabytes less memory than Django for normal inputs. Again, we see the memory used by Jinja increasing linearly with the number of template variables, where Django’s memory usage remains pretty much flat.

The story is similar when rendering variables in a loop: for all practical inputs, Django appears to render faster than Jinja. Interestingly though, this time Django slows down in much the same way Jinja did in the first test, the number of variables vs render time.

When testing the number of loop iterations vs memory usage, again Jinja used significantly less memory than Django, throughout the test range.

 

The performance of extensions is where Jinja really shines. Our new Jinja snippets rendered significantly faster and, as expected, used much less memory than our Django equivalents.

Real World (w/ Caching) Testing

The next step was to test performance with real data. Five thousand different templates from the Sendwithus database were rendered with real-world data. Given the way Django outperformed Jinja in the benchmarks, we expected similar performance on real templates. But to our surprise, Jinja was nearly 4.5 times faster than Django across the dataset.

By caching the compiled Jinja templates, we were able to improve performance by more than 10x over our old email rendering system.

Conclusions

Given the huge performance differences between our benchmarks and the performance of rendering real templates within Sendwithus, we were reminded to be wary of somewhat contrived benchmarks. Still, the benchmark performance gains on our Jinja snippets extension is promising. One of the reasons we were most stoked about switching to Jinja was the ability to easily write innovative and high-performing new template extensions.

Veronica Best, VP of Product

Voracious reader and self-professed #emailgeek. Passionate about all things product. VP of Product at Dyspatch.

  • LinkedIn

    Related Posts

  • Sendwithus Update Fourteen
  • Sendwithus is Upgrading to Jinja
  • Introducing Email Guardrails: Never see a Gmail message clipped message again
Share this post:
  • Facebook
  • Pinterest
  • Twitter
  • Linkedin
LET’S CHAT!

Why wait? Take your email marketing to the next level today.

Get a demo

5307 Victoria Drive #899
Vancouver, BC
V5P 3V6

548 Market Street,
San Francisco, California
94104 US

  • Phone 1-877-458-9231
  • Email us@dyspatch.io
    security@dyspatch.io
  • Facebook
  • Twitter
  • Instagram
  • LinkedIn
  • YouTube

Get the latest email strategies, tips, and trends right to your inbox.

About Dyspatch

  • About us
  • Careers
  • Contact us
  • Pricing
  • Press & Media
  • Release Notes

Find your fit

  • Tools for email Designers
  • Dyspatch for translators
  • Email production for Marketers
  • Resources for email Developers

Features

  • Dyspatch overview
  • No-code email builder
  • Email collaboration
  • Email template localization
  • AMP for Email
  • Sample AMP email templates
  • Expert Services
  • Sendwithus Overview
  • Agency Program

Email resources

  • Blog
  • Webinars
  • Ebooks Guides & Reports
  • HTML email templates
  • Knowledge base
  • Figma email builder
  • The Dyspatch Block gallery

Integrations

  • Partners & Integrations directory
  • Email builder for Braze
  • Email builder for Iterable
  • Email builder for Salesforce Marketing Cloud
  • Email builder for Pardot
  • Email builder for SendGrid
  • Email builder for Marketo
  • Email builder for HubSpot
  • Email builder for Oracle Eloqua

Dyspatch respectfully acknowledges the Lekwungen and W̱SÁNEĆ People, whose unceded territories we live and work on. We would also like to express our gratitude to all of the Coast Salish people as we continue to work and live as guests on their lands.

We recognize that acts of colonization created many inequities for First Nations, Inuit, and Métis people. As a company, we acknowledge that we have a responsibility to work towards reconciliation and to remain open to suggestions and consultations, especially with Indigenous communities.

Privacy policy    |    Terms of service    |    Web accessibility    |    Cookie policy    |    Usage    |    Sitemap

Copyright © 2025 Techdrop Labs Inc. All Rights Reserved.


Features & Functionality
Starter Teams Teams+
Universal styling  ✓  ✓  ✓
Drag and drop email builder  ✓  ✓  ✓
Custom code editor  ✓  ✓  ✓
Custom fonts  ✓  ✓  ✓
Device specific elements  ✓  ✓  ✓
Version history  ✓  ✓  ✓
Social media link settings  ✓  ✓  ✓
Commenting  ✓  ✓  ✓
Live previews  ✓  ✓  ✓
Dark mode previews  ✓  ✓  ✓
Litmus testing  ✓  ✓  ✓
Custom merge fields  ✓  ✓  ✓
Image hosting  ✓  ✓  ✓
Brand & legal compliance guardrails  ✓  ✓  ✓
User role permissions  ✓  ✓  ✓
ESP logic  ✓  ✓  ✓
Code Export  ✓  ✓  ✓
AMP Email Support  ✓  ✓  ✓
Approval Workflows  ✓  ✓  ✓
API Access  ✓  ✓  ✓
User Management –  ✓  ✓
Translation (via Smartling) – –  ✓
Export via API – –  ✓
Localizations – –  ✓
Account Manager – –  ✓
Premium Support – –  ✓
SLA – –  ✓
Premium SAML SSO – –  ✓
Custom Themes – –  ✓
Workspaces – –  ✓
Design / AMP Services – –  ✓
Pricing $149/mo $499/mo Custom
Get a demo

Get a quote