Hacker News new | past | comments | ask | show | jobs | submit login

It would be worth verifying that NODE_ENV=production is set during these benchmarks (I see no mention in either the article or the source repository.) Running in development mode has a significant performance impact.

Edit: This PR shows that is likely to be the case. Running in production mode along with some other minor changes shows React running at 88% the speed of Pug. https://github.com/janit/node-templating-benchmark/pull/1

NODE_ENV=production definitely wasn't set based on some basic testing I did (that's my PR there), which accounts for the atrocious performance.

Also, the React component is created on each request instead of just being created once. Unless one's goal is to specifically colour the perception of React, I don't understand that decision alongside the code for Pug which precompiles the template a single time.

(Also declaring the map function outside the component and not creating a closure makes for a tiny extra boost.)

It's disappointing to see that the article took off to this extent given how misleading and inaccurate it is.

Hello Anatoli. Thank you for this. It was clearly an oversight on my part, not intentional to make React look bad. I have added a note on the article and will run the tests with the correct settings and your PR with further optimisation.

Then you should withdraw the article until you get real numbers. This utterly misleading data (as of now) is going to be picked up by search engines and other blogs.

Add: on a positive note, this aspect of React is worth benchmarking. Thank you for that.

No worries. The reader has as much responsibility to question the material they're consuming :)

It’s common in the dev (esp. JavaScript) community. The wild rush to be first to discover or disagree for karma points on the internet.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact