Optimizer wishlist #214
wmertens
started this conversation in
Proposals For Qwik
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
segment generation
For example,
qrl(() => import('./foo.js'), 'foo', ...)
would become
/* top level */ const importFoo = () => import('./foo.js');
/* ...some function... */ qrl(importFoo, 'foo', ...)
and qrl would use a WeakMap to keep track of resolved imports.
{props.foo.thing ? props.foo.thing * 2 : null}
should becomefnSignal(p0 => p0.thing ? p.thing * 2 : null, props.foo)
and not
fnSignal(p0 => p0.foo.thing ? p.foo.thing * 2 : null, props)
.This helps with serializing only store data that's used.
Exception for when an intermediate prop is
value
, then it is probably a signal and it should be passed as a signal.fnSignal(p0 => p0.value.thing ? p.value.thing * 2 : null, signal)
This is legal JS but breaks during segmentation because of the scope capture:
{...props}
, make it so that var and const props are handled efficientlySuper optimization opportunities
Meaning, during SSR when you're checking an event handler for state to serialize, you mark RO signals as such and skip their effects for now. Any RW signals have to add their effects, and when they encounter e.g. a computed signal, that also becomes RW.
This way we avoid data and JS that will never be used.
This way we avoid missing contexts for dynamically added components.
Note that this only works for statically used contexts. When using a dynamic context id, we fall back to the current behavior, which requires explicitly calling
useContext
afteruseContextProvider
when you want to force context inclusion.optimizer code
cargo bench
works and set up https://github.com/benchmark-action/github-action-benchmark to track performance over time. Do this before oxc migration.fs
related code, single file processing onlyBeta Was this translation helpful? Give feedback.
All reactions