3 ms·
I mean, if you don't understand how specialized inlined code could be faster than a generic function, or how not creating temporary arrays could be faster than
by codeflo 2y ago
I mean, if you don't understand how specialized inlined code could be faster than a generic function, or how not creating temporary arrays could be faster than creating them, then it's clear that you can't see that there could be any benefit.
I can't judge the React compiler yet, but in general, compilation steps don't cause cognitive load if they work. How many different levels of interpretation and compilation does V8 do? And do you care? Do you have to? No, and that's the point. Whether React Compiler reaches the same level of "it just works", we'll have to see.
- afavour 2y ago> How many different levels of interpretation and compilation does V8 do? This part is key to the OPs objection. They’re saying that V8 is a very capable optimizer (which it is), so why can’t it optimize the things React Compiler optimizes? It’s a fair question. > compilation steps don't cause cognitive load if they work Personally I disagree. Any source code transformation adds cognitive load because my original source code now doesn’t match the source in the browser. Source maps are the traditional answer to that but if React is rewriting logic (like getting rid of arrays) you’re not going to be able to maintain a 1:1 source map.
- a_wild_dandan 2y ago> They’re saying that V8 is a very capable optimizer (which it is), so why can’t it optimize the things React Compiler optimizes? Because capable != exhaustive? All compiled languages can benefit from further optimizations. I genuinely don't understand the issue here. Help!
- andybak 2y agoI think OP is questioning whether these are optimizations or whether they are just redundant. I don't know the answer - I don't use React personally.