-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow compilation with long method chains #1033
Comments
I'm using LAB.js for script loading, with code like this: $LAB.script('foo.js').script('bar.js').script('baz.js') etc etc In my development environment, this chain is about 20 calls and it now takes minutes to compile. I assume that long jQuery chains would have the same problem. |
I ran into this problem today and measured compile speed with increasing call chains. The compile time started growing exponentially after 15 chained calls. It doesn't matter whether parameters are passed or not, nor if it's the same method. Benchmark code is here: https://gist.github.com/924670 |
I tried a couple different tacks at this, but this little memoization fix seems to work, and is minimally invasive. Now you can compile source files like this without issue:
I'm still a little uncomfortable with unfoldSoak in general. It allows us to have syntax like this work:
Which means that the outer operation really has to be able to walk down to the inner soak, and do the right thing. But it's also kind of magical. If we lost the ability to have these sorts of soaked expressions, the code would become a good deal simpler. |
Reopen #756? |
Reported by statim on #coffeescript:
The text was updated successfully, but these errors were encountered: