-
Notifications
You must be signed in to change notification settings - Fork 357
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
Improve the JS performance for logic-heavy stylesheets #760
Conversation
var positionalNodes = trackSpans | ||
? [ | ||
for (var expression in arguments.positional) | ||
_expressionNode(expression) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good that this new syntax is performant!
@@ -40,7 +40,7 @@ void _js({@required bool release}) { | |||
// * We expect our test coverage to ensure that nothing throws subtypes of | |||
// Error. | |||
// * We thoroughly test edge cases in user input. | |||
if (release) ...["-O4", "--fast-startup"] | |||
if (release) ...["-O4", "--no-minify", "--fast-startup"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we comment on why we pass no-minify
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
The JS size doesn't really matter on the server side, and this makes profiling the release-mode binary substantially easier, as well as improving the quality of stack traces provided by downstream users.
The default implementation runs a type check, which was a performance bottleneck when compiled to JS. There's no need for this type check in practice, since we never pass a non-String value to the contains(), containsKey(), or remove() methods (and if we do, it will throw a TypeError in our tests).
As well as being arguably more readable, the toList() method was running a type check that was showing up as a minor bottleneck in JS profiles.
As expected, this substantially improves the JS performance in logic-heavy benchmarks. I believe the other changes are just noise.
See #113