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

Optimizer wishlist/roadmap #7275

Open
11 tasks
wmertens opened this issue Jan 24, 2025 · 0 comments
Open
11 tasks

Optimizer wishlist/roadmap #7275

wmertens opened this issue Jan 24, 2025 · 0 comments

Comments

@wmertens
Copy link
Member

wmertens commented Jan 24, 2025

This is a long-running issue to keep track of what to implement on the optimizer

segment generation

  • make QRL dynamic import functions modules scoped and memoize, so that we don't make promises needlessly.
    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.
  • If a QRL has no scope captures, move it to module scope entirely
  • JSX attributes like {props.foo.thing ? props.foo.thing * 2 : null} should become
    fnSignal(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)
  • in prod mode, if a segment has no imports other than qwik, rewrite it with p0, p1 etc and put it in / named after the hash of the segment code, and then re-export it. This will deduplicate the segment code.
    // original qrl123.js
    import {useLexicalScope} from '@qwik.dev/core'
    export const qrl123 = () => { const [signal] = useLexicalScope(); signal.value++ }
    
    // /segment-hash123.js
    import {useLexicalScope} from '@qwik.dev/core'
    export default ()=>{const [p0] = useLexicalScope();p0.value++;}
    
    // new qrl123.js
    import {useLexicalScope} from '@qwik.dev/core'
    export {default as qrl123} from '/segment-hash123.js'
    this needs some care in plugin.ts, which currently expects segments to be in the same path as the parent.

optimizer code

  • migrate to oxc for increased speed and better docs
  • The output format needs simplifying, we're not using a bunch of the fields
  • Get rid of the fs related code, single file processing only
  • add benchmarks as part of CI and complain when runtime or size increase
  • move the binaries into individual packages and add them as optional deps with cpu-dependencies, like esbuild and sharp do. This will decrease the qwik bundle size by a lot
  • use cross builds so we don't need separate runners in CI
  • don't use any experimental rust features and switch to the stable toolchain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant