-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
reduce spread code size by passing false to get_spread_update for static attributes #4896
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
reduce spread code size by passing false to get_spread_update for static attributes #4896
Conversation
Does this also fix a bug? I'm unclear on what the new test does. Unrelatedly, this also now conflicts with master. |
fe77890
to
f3b0809
Compare
f3b0809
to
9f0b678
Compare
@Conduitry the PR is mainly to reduce code size. the extra test case was copied from the one we had for Components https://github.com/sveltejs/svelte/tree/master/test/runtime/samples/spread-component-dynamic-non-object |
Did some benchmark, based on @kevmodrome @halfnelson suggestion, tried to compile + bundle + minify components in svelte-material-ui, generally if contain 1 ~ 2 spread attribute, the size actually increase by ~1%. I tried compile the demo page, which 1 page include multiple different components, the bundle size dropped to 1 ~ 2%. here are some results: benchmark resultsin [packages/](https://github.com/hperrin/svelte-material-ui/tree/master/packages)
in [site/src/routes/demo](https://github.com/hperrin/svelte-material-ui/tree/master/site/src/routes/demo)
not sure whether it is conclusively better? 🤷♂️ |
For network latency, it'd probably be a good idea to have the benchmark minify and gzip the output (if it's not already) since that's how these files will normally be served especially for sites that would be performance-sensitive. Though once it's on the client device it will be necessary to parse and execute the uncompressed files. I'm not sure what the tradeoff is here in the case that the gzipped output get bigger/smaller and the uncompressed does the opposite as to which is more important |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Given that the code reduction is small and unclear to be better in all cases, and given that the code is outdated, I'm closing this. |
Reduce code size by:
false
forget_spread_update
for static attributes to reduce codesizeget_attributes_for_spread
util to reuse for initialise attribute data for spreadAlign the code for spreading in Component and element,
Before submitting the PR, please make sure you do the following
npm run lint
!)Tests
npm test
oryarn test
)