Merge internal transformers into single traversal pass#1472
Conversation
There was a problem hiding this comment.
Whitespace and comments were removed because the comments were outdated and the whitespace separating transformers was pretty arbitrary and gave the impression that it was somehow significant/related when it wasn't in the slightest.
|
Before After Not nearly as substantial as I'd hoped 😞 |
|
Actually, seems to make some difference. Compiling the entire Ember core source with Babel on On this branch it takes: Going to need to get some more numbers before I move forward with finishing this refactor though since I don't want to waste too much time if it's pointless. |
|
💃 |
|
Grr, looks like it's due to the |
|
works! |
|
Yay! |
|
Compiling Traceur which has a ton of ES6 so it's a more reflective benchmark:
|
|
Seeing on average a ~30% improvement on actual ES6 codebases. |
|
A 130-150 seconds build is now 80-90 seconds. I wish I had your emoji game right now, but here is my best: 💥 👊 😝 👯 👯 |
|
This is a fantastic PR guys! 😄 👍 |
|
So |
|
Moreorless, yeah. Doing the prepass itself was pretty expensive, especially on large trees and the "merged" visitors basically eliminates it's usecase. |
|
I don't see any |
|
I kinda cheated a bit and add the |
|
I'm surprised they all can now work in a single pass. How did you get rid of ordering? |
|
Well they sorta work in a single pass. There's still 97/414 tests failing. Basically, previously the visitor format was: {
Identifier: {
enter: Function,
exit: Function
}
}Now {
Identifier: {
enter: [Function],
exit: [Function]
}
}The Ordering wasn't really removed. If you have two transformers that define |
|
Ok, can you check in (or create another repo) with your Traceur benchmark? so we can track how we're doing |
|
Sure, there's a single syntax error that Traceur allows that Babel doesn't that I've had to change but just checkout this fork and run: $ time babel src --out-dir lib --blacklist es6.destructuringThere are some oddities with the Another thing I've found is that blacklisting |
… calling pre and post methods
…rder of what they need and what they actually do
…lasses transformer
…loops in the es6.blockScoping transformer
Merge internal transformers into single traversal pass
|
All tests now pass. Going to merge into |
|
Boom! Any final numbers? |
|
Traceur: Before: After: Ember: Before: After: Not as dramatic as I would've hoped 😞 Need to find out where that extra bit went. Mind running it on one of your apps? |
|
Will do |
|
It's a consistent 20% This is without adding |
|
Awesome! Also I renamed the |
|
👍 |
|
Sweet! |
Complicates the internal transformer state fairly signifcantly but adds a transformer metadata
groupproperty that allows the merging of transformer visitors with the same group.This isn't ready to be merged yet. Currently around ~100 tests failing. These are a combination of mixed state issues and infinite recursion bugs due to the changes required in the traversal algorithm to accommodate multi-method visitors.
cc @amasad @DmitrySoshnikov