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

Minification could benefit from compact initialization #16601

Closed
stevemessick opened this issue Feb 6, 2014 · 4 comments
Closed

Minification could benefit from compact initialization #16601

stevemessick opened this issue Feb 6, 2014 · 4 comments
Labels
closed-obsolete Closed as the reported issue is no longer relevant dart2js-optimization type-enhancement A request for a change that isn't a bug web-dart2js

Comments

@stevemessick
Copy link
Contributor

[user feedback]

Dart2Js outputs a section of this form (if I understand is correct, it for type checks using the is keyword):

P.XkM.$isa=true
P.L8.$isL8=true
// 500 more lines...
P.L8.$isa=true

It about 7kb big atm, writing it as one expression would save some kb:

P.XkM.$isa=P.L8.$isL8=P.L8.$isL8=true
////////////////////////////////////////////////////////////////////////////////////
Editor: 1.2.0.dev_02_04 (2014-01-31)
OS: Windows 8 - amd64 (6.2)
JVM: 1.7.0_21

projects: 1

open dart files: 0

auto-run pub: true
localhost resolves to: 127.0.0.1
mem max/total/free: 1778 / 752 / 499 MB
thread count: 28
index: 723264 relationships in 140040 keys in 17517 sources

SDK installed: true
Dartium installed: true

@floitschG
Copy link
Contributor

Added Optimization label.

@rakudrama
Copy link
Member

These 'assignment style' initializations should be more declarative, and moved to the class constructor descriptor object, something like:

L8: {
...
ctor:{$isL8:!0,$isa:!0},
...
}

This form would be shorter on average.
This would be helpful for delayed loading, since all aspects of the class would be in one place.


cc @sigurdm.

@floitschG
Copy link
Contributor

Removed the owner.

@rakudrama
Copy link
Member

Rewriting multiple assignments as one expression is something we could do.
This also occurs in the initializers for top level and static variables.

There is almost no benefit after gzip.

@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed priority-unassigned labels Feb 29, 2016
@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-obsolete Closed as the reported issue is no longer relevant dart2js-optimization type-enhancement A request for a change that isn't a bug web-dart2js
Projects
None yet
Development

No branches or pull requests

5 participants