PHP vs Node.js - Is HTML Rendering slower in Node.js with Jade?

前端 未结 4 615
感动是毒
感动是毒 2021-02-06 01:23

Assuming that we have millions of requests per day. Is the HTML processing in Node.js with Jade slower or faster than PHP\'s render engine? Or doesn\'t matter because th

相关标签:
4条回答
  • 2021-02-06 01:38

    Jade templates are memory cached, so the second request will be almost immediate. If you are concerned about templating speed with jade, you can use self option.

    0 讨论(0)
  • 2021-02-06 01:43

    Jade isn't designed for speed, it's designed for elegance. If you're really concerned with speed there are other javascript rendering engines that are faster.

    Check out http://jsperf.com/dom-vs-innerhtml-based-templating/63 (note that the chrome results match closely to node.js performance)

    But that's all assuming the rendering engine is the bottleneck, and not the DB.

    0 讨论(0)
  • 2021-02-06 01:46

    First off, I know this is VERY OLD but I would like to meta tag my benchmark to help other seeking the Jade vs decisions. I added a benchmark comparing both recently since I got stuck picking out a template engine. I choose twig because I already used it and have never used Jade. I do like how simple Jade is and can be beneficial for getting "quick web apps" up however I've written HTML and CSS for over 15 years and seeing the markup makes me smile.

    Express - Jade vs Twig Benchmarks:

    0 讨论(0)
  • 2021-02-06 01:47

    The views in Jade are compiled to actual Javascript, and then cached for latter use. In terms of rendering Jade is as fast as rendering a page written in raw Javascript. The compile time does add an initial over head, but you should only need to compile the code once(most likely when node initially starts up).

    Your welcome to run the tests, but basically php is typically interpreted on each request(obviously memache does kick in), while the jade views should be completed cached in memory.

    0 讨论(0)
提交回复
热议问题