5 ms·
Curious about your performance experience with Node - the TechEmpower benchmarks have Node at about 2-4x the speed of Flask: https://www.techempower.com/benchm
by nostrademons 11y ago
Curious about your performance experience with Node - the TechEmpower benchmarks have Node at about 2-4x the speed of Flask:
https://www.techempower.com/benchmarks/#section=data-r11&hw=peak&test=fortune https://www.techempower.com/benchmarks/#section=data-r11&hw=...
And my experience is generally also that V8 beats the pants off CPython in performance.
I suspect that part of the problem is that the node ecosystem encourages you to just "npm install" whenever you have a problem, and so you have 3-4 layers of third-party libraries doing minimal work (but consuming lots of CPU cycles) on top of your problem space. But if that's the problem - don't do that. Flask is a microframework; it's trivially easy to build a small microframework on top of the Node.js stdlibs. Node was meant as a scriptable high-performance C++ server, after all, and there's nothing stopping you from using it as one.
- Gratsby 11y agoThe benchmark is a little strange. It has a range of 723 requests (CherryPy) for a plaintext hello world to 6.8Million (ulib) for plaintext. I looked at the Flask numbers and they don't compare with my own - I got between 3 and 4 times that when I benchmarked it myself on hardware that I'm sure was older and less powerful (and I didn't bother to turn off logging). I looked at the node code and it does not use express - which could very well be the difference I am experiencing. I'll tell you what though... I'm going to have a look at ulib for static files!
- rlander 11y agoYou should compare Flask to Express or Koa, not raw nodejs. Flask is 3x faster than Express and 2x faster than Koa.
- nostrademons 11y agoThe thread-starter's question was asking about Flask vs. Node.js and Tornado, so I answered accordingly.
- codesushi42 11y agoCan you cite your source?
- rlander 11y agoJust follow the link to the Techempower benchmarks on grandparent's post.
- maxthegeek1 11y agoFollowed the link, it shows plaintext from express at 2.1% and flask at 1.3%. Am I missing something?
- nostrademons 11y agoFlask is on there about 3 times, with different choices for ORM. It's at about 8% when used without an ORM. There's no sans-ORM configuration for Express, though, so still not an apples-to-apples comparison. I suspect the grandparent missed the other Flask configurations in the very long list.