3 ms·
Cool. Another question since you are around: How many of your sea-of-nodes-level optimizations do you think can be applied instead as AST-level optimizations?
by zomglings 6y ago
Cool. Another question since you are around: How many of your sea-of-nodes-level optimizations do you think can be applied instead as AST-level optimizations?
- chrisseaton 6y agoWell you can see the one in the article about sharing the computation from the two branches - there's no way to represent that in an AST, for the very reason that it's a tree - there can only be one user of a node in an AST, but in a graph, multiple nodes can use it. You could introduce some kind of hidden local variables and assign to those, but then you're kind of building a graph in an AST, and might as well use a graph, and those variables are harder to understand for other optimisations. (Note that these aren't 'my' optimisations, I'm just writing about them.)