[⚡] [V2] every useComputed$ gets its own tiny chunk, and resume imports all of them at load
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 28/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- rollup, typescript, vite
調査の方向性
Start with EAGER_CTX_NAMES and the rolldown group logic in packages/qwik-vite/src/plugins/plugin.ts, then the signal QRL resolution in inflate.ts. The reporter's draft PR #9366 already proposes placing computeds with their creating entry, so review that before proposing another approach. Done means the chunking decision is settled and the resume path no longer issues one dynamic import per computed, which needs maintainer agreement on the design.
索引モデルが issue の本文から書いたものです。
説明
Which component is affected?
Qwik Core (optimizer / build)
Describe the bug
Hey 👋
In a production build with the default smart entry strategy, every useComputed$ segment ends up in its own tiny chunk (70 to 500 bytes), because the rolldown group for the "eager contexts" returns null for them:
https://github.com/QwikDev/qwik/blob/main/packages/qwik-vite/src/plugins/plugin.ts (EAGER_CTX_NAMES, with the comment "Eager contexts stay with their parent, not a segment chunk" and a TODO about useComputed$)
Since 7f51ab522 the runtime resolves the QRL of every serialized computed signal while resuming (inflate.ts), so a page pays one dynamic import() per computed at load, before any of them is needed. In v1 a computed's code was only loaded when it had to recompute, so the split cost nothing there.
On a page of mine with 38 computeds at load this showed up as the biggest part of the resume task: importSymbol took 52 ms self time (4x CPU throttle) against 7 ms for the same app on Qwik 1.x, and the page had a 122 to 134 ms long task right after qresume (Lighthouse mobile, chords page, text heavy, about 620 DOM nodes).
I opened a draft PR that treats a computed like useTask$ (it ships with the chunk of the entry that created it): https://github.com/QwikDev/qwik/pull/9366
Numbers, same app and same data, Lighthouse mobile, 3 runs each:
| TBT | long task after resume | |
|---|---|---|
| main as is | 88 to 106 ms | 122 to 134 ms |
| with the PR | 58 to 68 ms | 100 to 103 ms |
(For comparison the same page on Qwik 1.x has about 5 ms TBT, the rest of the gap is state deserialization at resume.) The same 38 computed symbols still run at load.
How to see it
Build any app with a few useComputed$ in components that are server rendered and look at dist/build: one chunk per computed, each exporting a single s_... symbol. Then load the page and look at the network tab right after resume.
I can put together a small repro repo if that helps.
System Info
Binaries:
Node: 24.16.0
npmPackages:
@qwik.dev/core: 2.0.0-rc.4 (+ main)
vite: 8.x
- 主要言語
- TypeScript
- スター
- 22.1k
- フォーク
- 1.4k
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 159
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
QwikDev/qwik のほかの issue
-
Reveal: resolved but blocked Pending boundary hides its fallback対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
docs router V2
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
DX enhancement V2
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
QwikDev/qwik#8480 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
preloader V2
難易度 4/5 1〜2日 初心者へのやさしさ 58/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
solidjs/solid-docs#1716 ·
メンテナーはふだん 1 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Progress indicated by console logs is off by one対応中かも @marceliwac が今日担当しました。 オープンbug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws-samples/aws-cdk-examples#1336 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
melgarafael/DeskcommCRM#4999 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信