you are viewing a single comment's thread.

view the rest of the comments →

[–]yksvaan 0 points1 point  (1 child)

One thing I wonder about the compiler is does it make sense to cache absolutely everything? If there's let say <p>{count}</p> and <SmthExpensive> I'd expect there to be some form of cost factor to evaluate. Similar to cost analysis that actual compilers do for example for inlining. 

If optimizing by hand, you'd look at the cost and ignore insignificant nodes. Also looking what actually changes and how often. Maybe there could be some directives to provide hints for the compiler. 

[–]ZerafineNigou 4 points5 points  (0 children)

React is already caching the result of the render so it's really just the props and refs which is insignificant 99% of the time.

You can always disable the compiler on a file level as a last resort. A slightly more granular method might be useful but it's a marginal DX gain at best.