Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 288
Adam Halasz Avatar asked Jun 01 '11 02:06

Adam Halasz


People also ask

Is PHP faster than NodeJS?

Due to the V8 engine, asynchronous execution, and real-time server interaction, Node. js offers a better execution speed and certainly outperforms PHP.

Is node JS slower than PHP?

js faster than PHP? Because of a slower loading process rendered by PHP, Node. js is the winner in terms of performance and code execution speed. It eliminates the waiting downtime and provides real-time data in a much more efficient manner, which allows using Node.

What is the advantage of node .JS over PHP?

Comparing Node. js with PHP, the first is inherently asynchronous, event-driven, and non-blocking, while the second is a synchronous programming language. This means that Node. js is more viable than PHP for speeding up development.

Is PHP 7 faster than node JS?

js may be faster than the “standard” webserver with PHP because it runs as a single thread with non-blocking IO for each connection, hence there is no memory overrun. Due to this, Node. js is useful when there is a need to process data in real-time (chats, games, video, big data streams without logic). However, Node.


1 Answers

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.

like image 132
generalhenry Avatar answered Oct 09 '22 08:10

generalhenry