4 ms·
> Every time I've done a test, React is significantly slower than using standard JavaScript + DOM I'd be interested in seeing those tests.
by eschutte2 10y ago
> Every time I've done a test, React is significantly slower than using standard JavaScript + DOM
I'd be interested in seeing those tests.
- localvoid 10y agoI also curious to see how web components will be faster than simple javascript objects :) React apps are usually built with many layers of components that returns another components. And with standard Web API, there will be significantly more DOM nodes because each component is a DOM node.
- acdha 10y agoTry beating a loop where e.g. every time you get a change you do something like getElementById() + .textContent = newValue. There's no way for React to be faster than that because it has to eventually do the same work but there are many ways for it to be less code, more correct (e.g. by not forgetting to call the update in some cases), or otherwise easier to get to the point where your app can ship.
- dmitriid 10y agoSomeone has tried beating the loop. And more than a loop, but rather a more real-life-like test rendering multiple components and component trees, sets attributes etc. etc. and you can run it on your own computer in the browser You can check it out yourself: https://localvoid.github.io/uibench/ https://localvoid.github.io/uibench/ I highly recommend the author's article about it: https://medium.com/@localvoid/how-to-win-in-web-framework-benchmarks-8bc31af76ce7#.9c6vng748 https://medium.com/@localvoid/how-to-win-in-web-framework-be...
- localvoid 10y agoAlso, it seems that many people are defending WCs with an argument about interoperability. But in reality, if we start adding components that are using different frameworks, there will be problems with layout thrashing, etc, because there is no standard scheduling APIs, and each framework implements its own scheduler to batch reads and writes https://github.com/ampproject/amphtml/blob/8a76ee942f329179d1b73d93d3de8d74bc464629/src/service/vsync-impl.js#L46-L47 https://github.com/ampproject/amphtml/blob/8a76ee942f329179d...
- eschutte2 10y agoYes. If you're already checking for changes yourself then you've basically rewritten React.
- jbergens 10y agoLook at the tests for inferno, it is close to js + dom for some things and inside 2x factor for bascially everything if I remember correctly. The main thing is development speed anyway, fast enough while still easy to write and maintain code.