Hey everyone! I'm considering making a switch from PHP to Node/Express.js for my web projects, but I have some concerns about performance. Specifically, does anyone have insights or data regarding the page load speeds between PHP 8 (especially when using inline) and Express.js with res.render()? Since loading speed is crucial for me, I'd love to hear your thoughts! Also, which Node template engine do you think is the fastest?
3 Answers
The key difference lies in their execution models. With PHP, you can use php-fpm for concurrency without too much concern about memory issues. Node runs everything in a single process asynchronously, which allows it to manage concurrent requests effectively. Overall performance will depend more on your database and network latencies than on the language itself.
Generally, you shouldn't expect a big difference in page load times unless your setup is pretty unique. The latency from your users to your server is usually just a few milliseconds, and rendering time for templates is often less than a millisecond, even with various systems.
Performance-wise, both options are fairly comparable. You might lean towards Node if you're doing a lot of asynchronous tasks and want to maximize server efficiency. PHP could be preferable if you want stability in dependencies and easier hosting setups.
But isn’t running Docker containers a pretty straightforward method for deployment? Isn't it crucial to maintain a consistent environment between development and production?