16:23 | <jschoi> | nicolo-ribaudo published https://github.com/babel/babel/pull/14278. It tries to inline topic references by replacing them with their LHSes when they’re pure. Very cool! |
16:24 | <jschoi> | I hadn’t known that a path.isPure method was already implemented in Babel… |
16:26 | <nicolo-ribaudo> | We already use it to optimize in multiple places! |
16:28 | <nicolo-ribaudo> | The next step will be to introduce an "assume that imported bindings are constant" option, since it's what will help in most cases. Otherwise this code still needs tmp vars:
|
16:29 | <nicolo-ribaudo> | because a call to map might change what filter is |
16:30 | <pokute> | I'm interested in which of these assumptions would apply for TypeScript downlevel transformations too. |
16:35 | <pokute> | I wonder if TS has such purity checks too. I guess optimizing even literals would be helpful... |
22:34 | <TabAtkins> | Ah the purity constraint is because of the swapped order of evaluation, interesting |