3 ms·
The new output has bundle size improvements (per the announcement) but each call to the pragma function now instantiates a new Object. I'm curious if there are
by JMTQp8lwXL 6y ago
The new output has bundle size improvements (per the announcement) but each call to the pragma function now instantiates a new Object. I'm curious if there are performance implications in very large React applications.
- lucideer 6y agoI guess every application will be different, so maybe, but this comes along with a large push to improve the performance of React's factory functions so it would be difficult to measure objectively.
- swyx 6y agowhat specifically did you mean by factory functions? if you meant createFactory, fwiw that was legacy and is now deprecated https://reactjs.org/blog/2020/02/26/react-v16.13.0.html#deprecating-reactcreatefactory https://reactjs.org/blog/2020/02/26/react-v16.13.0.html#depr... but if you meant createElement... i'm not sure the goal is perf? then again there was a lot to cover in that RFC and i may have missed something
- lucideer 6y agoSorry, yeah by "factory function" I just mean a function that generates element definitions for the renderer. `createElement` or `_jsx` in this case. W.r.t. the goal being perf., I'm not intimately familiar enough with React's source to know the exact gains (or losses) but there's a fair bit of discussion around perf. in the RFC thread. e.g. https://github.com/reactjs/rfcs/pull/107#issuecomment-520887661 https://github.com/reactjs/rfcs/pull/107#issuecomment-520887... re: prop re-use and https://github.com/reactjs/rfcs/pull/107#issuecomment-466487481 https://github.com/reactjs/rfcs/pull/107#issuecomment-466487... re: bit flags. There's also a lot of discussion around whether these are compelling, so it might not improve perf. at all.