4 ms·
Try 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 faste
by acdha 10y ago
Try 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.