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

Improve the JS performance for logic-heavy stylesheets #760

Merged
merged 5 commits into from
Jul 15, 2019
Merged

Conversation

nex3
Copy link
Contributor

@nex3 nex3 commented Jul 12, 2019

See #113

@nex3 nex3 requested a review from srawlins July 12, 2019 20:26
var positionalNodes = trackSpans
? [
for (var expression in arguments.positional)
_expressionNode(expression)
Copy link
Contributor

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"]
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

nex3 added 5 commits July 15, 2019 21:59
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.
@nex3 nex3 merged commit f2bc521 into master Jul 15, 2019
@nex3 nex3 deleted the js-perf branch July 15, 2019 21:43
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

Successfully merging this pull request may close these issues.

2 participants