Skip to content
bminer edited this page Jun 7, 2012 · 8 revisions

How fast is Blade?

The Blade parser/compiler is a bit slow. That's probably okay because Blade makes it easy to cache compiled views. If you use Blade with Express, for example, Express will automatically cache compiled views when running with NODE_ENV === "production".

The most crucial part of Blade's performance lies with the performance of compiled templates and the performance of the Blade runtime. I'm pleased to say that the runtime is pretty darn fast. On my computer, I can render a reasonably complex template with file includes in less than 1ms. This test was performed on Google Chrome v18 on Windows 7 on a two-year-old laptop (i7 processor). I got around 12,000 renders per second.

Blade Performance Summary on a "decent" computer:

  • Minified template render time: ~10,000 - 14,000 renders per second (pretty darn good)
  • Minified template compile time (no caching): ~350 - 400 small templates per second. This is around 4,000 lines of Blade per second... like I said, quite slow.
  • Minified template compile time (with caching) ~100,000+ templates per second (yay caching!)

You can test the performance of Blade on your machine by running the test/benchmark.js file.

Output of benchmark.js on EC2 m1.medium instance (Ubuntu 12.04, Node 0.6.18, Blade 1.3.3):

Blade performance:
------------------
Blade test suite statistics:
        Files: 24
        Total number of lines: 303

Parse the entire test suite 40 times: 1572ms
Compile (cache off, minify on) the entire test suite 40 times: 2583ms
Render (cache off, minify on) the entire test suite 40 times: 3212ms
Compile and cache the entire test suite 1 times: 72ms
Compile (cache on, minify on) the entire test suite 1000 times: 220ms
Render (cache on, minify on) the entire test suite 1000 times: 1963ms
Clone this wiki locally