PHP vs Node.js - 用Jade在Node.js中HTML呈现速度较慢? [英] PHP vs Node.js - Is HTML Rendering slower in Node.js with Jade?

查看:123
本文介绍了PHP vs Node.js - 用Jade在Node.js中HTML呈现速度较慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们每天有数百万个请求。使用Jade的Node.js中的HTML处理是否比PHP的渲染引擎慢或更快?或者不重要,因为差异非常小? 我使用 Node.js Jade模板引擎,我非常喜欢它。但我一直是担心表演的人。我从PHP开始了我的开发生涯,这很有趣,但现在Node看起来好多了,所以我决定切换。

我使用Jade渲染HTML,因为node.js本身缺乏它(我知道这听起来有点愚蠢,因为Jade也是节点:P)。但是因为Jade是Node中的一个模块,所以我有点困惑,也许这会降低渲染过程的速度。

解决方案

Jade并非专为速度而设计,而是为优雅而设计。如果你真的关心速度,还有其他的JavaScript渲染引擎更快。



查看 http: //jsperf.com/dom-vs-innerhtml-based-templating/63 (请注意,chrome结果与node.js性能密切相关)



但是,这一切都假设渲染引擎是瓶颈,而不是数据库。


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 the difference is really small?

I'm using Node.js with the Jade template engine, I really like it. But I was always the guy who worried about performance. I started my developer career with PHP, it was fun but now Node seems much much better, so I decided to switch.

I use Jade to Render HTML, because node.js alone lacks it(I know this sounds a bit stupid because Jade is node too :P). But because Jade is a module in Node I'm a bit confused, maybe this can slow the rendering process down.

解决方案

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.

这篇关于PHP vs Node.js - 用Jade在Node.js中HTML呈现速度较慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆