esnext / es6-module-transpiler

Tomorrow’s JavaScript module syntax today
http://esnext.github.io/es6-module-transpiler/
Other
1.21k stars 85 forks source link

Performance hit from 0.4 -> 0.5+ #165

Closed dfreeman closed 9 years ago

dfreeman commented 10 years ago

I know this is a bit of an apples and oranges situation, since the overhaul that took place for 0.5 paved the way for a lot of great new functionality, but the actual transpilation process seems to be a couple orders of magnitude slower today than it was in 0.4.

I've thrown together a JSBin to run the two side by side. One sample run, for instance, on the lodash source took 23ms with 0.4.0, and over 6 seconds in 0.8.0.

I haven't dug in too deep, but a quick profiling run looks like most of the time is being spent in Recast, in particular in its LocationFixer#fix method.

image

Is this the ballpark performance to expect moving forward, or have I drastically misconfigured something? It feels like this is prohibitively slow for rebuilds in a development environment. Regardless, thanks for your work on this project!

caridy commented 10 years ago

@dfreeman we knew about the perf implications of moving into using esprima/recast, it is a matter of balance considering that we will be able to align with all esnext projects. we are committed to improve to a certain degree, and any help will that will be welcome. (/cc @benjamn creator of recast)

dfreeman commented 10 years ago

@caridy Makes sense. I'd be happy to put some time into this at some point, either in the transpiler or Recast, if @benjamn knows of any low-hanging fruit that would be good to ramp up on the codebase with :)

benjamn commented 10 years ago

As a matter of fact, I have plans to eliminate the LocationFixer entirely, now that these commits have been merged into Esprima: https://github.com/ariya/esprima/commit/27d1d7740842a4a74c659b3b80b017d9855494c1 https://github.com/ariya/esprima/commit/233179e192c20a7c60554cfe1080198ba3df9892 https://github.com/ariya/esprima/commit/c8d226bf709353ccff9d9064fc3f864382ac9338

stefanpenner commented 10 years ago

@benjamn nice!

benjamn commented 9 years ago

LocationFixer is gone (since recast@0.9.1)!

stefanpenner commented 9 years ago

some what relevant to perfs: https://github.com/stefanpenner/basic-transpiler-benchmarks

stefanpenner commented 9 years ago

https://github.com/esnext/es6-module-transpiler/blob/master/package.json#L45 seems to indicate at-least master of this project depends on a sufficiently new version of recast.

@dfreeman curious how the results are now.

dfreeman commented 9 years ago

@benjamn Nice! @stefanpenner I'm a little bit swamped at the moment, but should have some time over the weekend to take a look.

stefanpenner commented 9 years ago

@dfreeman i would also like to add your scenario to my profile suite. I'll try to get to it this weekend swell.

dfreeman commented 9 years ago

Sorry for the slow turnaround; finally getting back to this. I'm consistently seeing numbers in the neighborhood of the following for the lodash source using http://jsbin.com/giwubilasa/4/edit?js,output

0.4.0: 13ms
0.8.0: 4417ms
0.9.6: 2089ms

Still slower than back in the old days, but it looks like more than half the time was shaved off between 0.8 (when I originally filed this) and 0.9.6 today, which is an awesome improvement :)

stefanpenner commented 9 years ago

@dfreeman but still 5-10x to slow, hopefully we (including myself) will get more time to work on this to help improve. I have been unfortunately swamped with other work. I have put together: https://github.com/stefanpenner/basic-transpiler-benchmarks to help others make progress.

benjamn commented 9 years ago

I've also been swamped with work, but @stefanpenner and @drslump have had some great ideas for further speedups (e.g. https://github.com/benjamn/ast-types/pull/81) that I'm really excited to merge as soon as I can give them a proper review.

eventualbuddha commented 9 years ago

I recommend you try http://esperantojs.org/ instead of this project. It's much faster, and it's where I'll be putting my efforts from here on.