3 ms·
Sorry. I should have shared the example I was thinking of as well. Just my example. [lengthy_array].map(function).filter(function).reduce(function). JS compi
by imvetri 7y ago
Sorry. I should have shared the example I was thinking of as well.
Just my example.
[lengthy_array].map(function).filter(function).reduce(function).
JS compiler just runs them.
A compiler to be powerful to handle such functional programming syntax should also have ability to inline the functions as a single function.
the above example could be recompiled as
[lengthy_array].array_operation(Three function composed into one)
- tom_mellior 7y agoOh, forgot to answer here. As a compiler developer I'm very surprised by the assertion that this wouldn't be optimized by something like V8 or GraalVM's JavaScript engine. But I couldn't JavaScript myself out of a paper bag, so I don't know how to verify this myself.