Skip to content
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

Performance Degradation With Multiple "each" #1070

Closed
akshayme opened this issue Jun 12, 2013 · 8 comments
Closed

Performance Degradation With Multiple "each" #1070

akshayme opened this issue Jun 12, 2013 · 8 comments

Comments

@akshayme
Copy link

Possibly related to #1064

Having updated Jade to 0.31.2, I've noticed that certain pages (usually involving multiple each statements) take significantly longer to compile - in one case, the time jumped from 71ms (for Jade v 0.30.0) to 5100ms. I suppose I could rewrite some server side code in order to provide jade with fewer each statements if necessary. Should I expect this performance drop moving forward?

@ForbesLindesay
Copy link
Member

Yes, the speed should improve somewhat over time. It will still be slower, but we hope to improve on the performance to the point where it is acceptable for development. It is still worth noting that the latest update is a performance improvement in production environments where jade templates are compiled ahead of time.

@tj
Copy link
Contributor

tj commented Jun 12, 2013

yikes I thought esprima was reasonably fast, that's definitely not ok for development if it's that slow

@ForbesLindesay
Copy link
Member

Esprima is fast, lexical-scope is not, and with relies on lexical-scope.

@ForbesLindesay
Copy link
Member

Looking at nodetime reports of compiling a pathological template it looks like the lions share of the time is spent in this function

@tj
Copy link
Contributor

tj commented Jun 14, 2013

wtf.. that code makes no sense to me, quite the mess, good thing he comments nothing

@vendethiel
Copy link
Contributor

substack's not well-known for code cleanliness :(

@tj
Copy link
Contributor

tj commented Jun 14, 2013

im sure we could do something that makes a lot more sense for "with", not hard to walk the ast and prefix pseudo "globals", seems like this thing does a bunch of other unrelated confusing things

@ForbesLindesay
Copy link
Member

Personally I think substack's code is fine. Could use a few comments but otherwise it's fairly sensible. The issue is that starting from esprima's output requires quite a lot of work. UglifyJS already does so much of this computation in order to mangle variable names so getting from that output to a list of globals is completely trivial and much faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants