News for hackers. Stuff that matters.
Re:HAML vs ERB vs SLIM in terms of render speed by jashkenas on Wednesday October 17, 2012 @09:48AM (#4664358)
For a bit of perspective, here's the same template being rendered with Underscore.js templates, under Node:

https://gist.github.com/3905579

Whereas the original Ruby templates in the original benchmarking do about 40-50 requests per second, with "c=1", the JavaScript templates do 1,732 requests per second on my laptop.

With "c=10", they do 2,370 requests per second.

Re:HAML vs ERB vs SLIM in terms of render speed by arthurschreiber on Wednesday October 17, 2012 @09:57AM (#4664417)
Well, that comparison is not exactly fair, is it?

While the rails benchmark tries to compare different template engines in the same language, framework, and with blocking IO, you're comparing these results to rendering under "pure" Node.js (no framework that slows you down) with non-blocking IO.

Don't take this the wrong way, tho, I'm absolutely blown away by your numbers!

Re:HAML vs ERB vs SLIM in terms of render speed by klaustopher on Wednesday October 17, 2012 @10:03AM (#4664449)
I agree, If you would be using Express.js or something similar I think node would give you numbers that look more like the rails stuff.

But I'm really interested in eliminating as much of the framework as possible to get more comparable numbers even to other platforms.

I'm also sort of blown away by the throughput node allows you.

Re:HAML vs ERB vs SLIM in terms of render speed by jashkenas on Wednesday October 17, 2012 @10:14AM (#4664489)
Ok -- you got it. I've updated the gist with the same template running through Express.

https://gist.github.com/3905579

Take note that the margin of variance on these numbers is several hundred, so don't read too much into small shifts ... but:

With Express, and "c=1", I get 1,876 requests per second.

With Express, and "c=10", I get 2,730 requests per second.

There isn't meaningful overhead imposed by Express for this particular simple template rendering.

Re:HAML vs ERB vs SLIM in terms of render speed by balupton on Wednesday October 17, 2012 @11:11AM (#4664769)
Running the same benchmark against DocPad a node.js framework, getting good speeds too (1147req/s). Benchmark: https://gist.github.com/3906050

Worth noting the tests are being run against a local copy of - http://docpad-kitchensink.herokuapp.com/ - which does a lot more stuff than the basic haml rendering.

Re:HAML vs ERB vs SLIM in terms of render speed by amikazmi on Wednesday October 17, 2012 @10:23AM (#4664532)
You can make the benchmark with Rails Metal, or with Rack. If you want to compare non-blocking IO, use with eventmachine.
Re:HAML vs ERB vs SLIM in terms of render speed by jeremyjh on Wednesday October 17, 2012 @02:24PM (#4665793)
Yeah I'm pretty sure the rails benchmark is IO-bound. If that is the case it is surprising there is any noticeable difference at all between the three different Ruby template engines.
Re:HAML vs ERB vs SLIM in terms of render speed by betageek on Wednesday October 17, 2012 @10:36AM (#4664611)
This is not very useful "perspective" - as far as I can see this benchmark is run using "rails s" which boots up the WEBrick server - I seriously doubt you'd find anyone using that in production! Maybe it's best to leave this as a Rails apple-to-apples comparison...
Re:HAML vs ERB vs SLIM in terms of render speed by klaustopher on Wednesday October 17, 2012 @11:50AM (#4664954)
I said that the results come from running webrick, I want to give the other servers a try. But in my opinion the web server shouldn't have anything to do with the render speeds of the template language. That's why I'd love to eliminate it altogether
Re:HAML vs ERB vs SLIM in terms of render speed by lerouxb on Wednesday October 17, 2012 @10:41AM (#4664634)
You'll find people saying the same thing about express or even node in general.
Re:HAML vs ERB vs SLIM in terms of render speed by zimbatm on Wednesday October 17, 2012 @11:46AM (#4664932)
On my system (only tested with c=1) in a comparable minimalist setup, ruby does 1477.48 and node 2541.61. Not too bad but still 2 times slower.

https://gist.github.com/3906254

Re:HAML vs ERB vs SLIM in terms of render speed by arthurschreiber on Wednesday October 17, 2012 @01:28PM (#4665533)
I'd even say that the biggest contributor to this difference is the non-blocking nature of Node. Using e.g. EventMachine would probably close the Gap between Node and Ruby even more.