[Bug] WebView rendering pins GPU at 5-8W continuously (44x vs native app, same streaming workload)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- css, html, javascript, rust, tauri
- 领域
- desktop, frontend, performance
调研方向
Start by profiling the WebView render process during streaming, following the reported timer-driven RemoteLayerTreeDrawingArea update path and checking the message list’s rendering and compositing. Compare GPU power and CPU use with the window visible and minimized, then check whether the suggested batching, layer audit, animation check, or list virtualization changes the measurements. Done means visible-window GPU use drops substantially during the same streaming workload.
由索引模型根据 Issue 内容生成。
描述
Environment
OpenBitFun 1.0.7 / macOS 27.0.1 (26A434) / MacBook Pro Mac17,2, Apple M5 (4P+6E), 16 GB / Liquid Retina XDR 3024x1964 ProMotion / renderer WKWebView (Tauri). Uptime 66 h.
Summary
With the window visible, the WebKit render process pins the GPU at 5.3-7.9 W; CPU+GPU sits at 9.1-10.0 W for ordinary chat use. Minimizing drops GPU to 0.06 W. Control: Zed (native Rust+Metal) doing the same foreground AI streaming draws 0.12 W GPU and 3.4-5.3 W total.
The render process uses LESS CPU than Zed (22.7% vs 33-37% of a core) yet draws 44x the GPU power. This is compositing cost, not compute.
Data
OpenBitFun foreground, streaming (powermetrics tasks, 1 s):
- WindowServer: 298.8 CPU ms/s, energy 1393.6, 698 wakeups/s
- WebKit.WebContent: 160.2 ms/s, energy 649.9
- WebKit.GPU: 39.3 ms/s, energy 141.7
- openbitfun-desktop: 32.5 ms/s, energy 103.2, 335 wakeups/s
- Control wpsoffice: 191.1 ms/s but energy only 51.9 (1/12)
Power in mW: CPU 4115/4343/3795/4722/3734, GPU 5335/5356/5340/5329/5313 (pinned), Combined 9450/9704/9124/10035/9079. Peak under heavy streaming: GPU 7922, CPU 13689, Combined 21433.
Window minimized vs visible (n=126/29 samples, 2 s cadence):
- GPU 0.06 W vs 5.30 W
- CPU 1.13 W vs 4.34 W
- CPU+GPU ~1.2 W vs ~9.6 W
- WindowServer 12.0% vs 43.0% of one core
- WebContent 8.5% vs 22.7%
- SystemLoad 8.14 W vs 12.17 W
Zed control (foreground streaming): GPU 0.12-0.13 W, CPU 3.31-5.16 W, combined 3.4-5.3 W, WindowServer 11.6-14.7%, RSS 242 MB. Note macOS Energy Impact ranks Zed HIGHER (1215-1724 vs 650-1005) because that score is CPU-driven; it is not a usable proxy for GPU-bound WebView cost.
Root cause evidence
2 s sample of WebContent while visible and streaming: 457/1210 samples inside __CFRunLoopDoTimers (38%), of which 318 in WebCore::timerFired -> 202 in the RemoteLayerTreeDrawingArea lambda -> 149 RemoteLayerTreeDrawingArea::updateRendering() -> updateCompositingLayers -> computeCompositingRequirements recursing 8+ levels.
So a timer-driven frame cycle runs even when only a few characters change, and every small DOM mutation re-walks a very large layer tree, re-encodes it over IPC, and re-composites 3024x1964 px (~700M px/s at ProMotion), which matches the sustained 5-8 W.
Secondary issues in the same session
- Main process wakes 335-352 times/s with no active tool call (energy per CPU-ms/s 3.2, vs 0.11-0.27 for native apps).
- GitStateManager polls without backoff: 3777 refreshes in 4h23m (~4.2 s); 19 zombie children accumulated under openbitfun-desktop.
- manage_dialog_queue fails every 10 s forever: 1613 ERROR lines "Session is not loaded on the execution host".
- 73 uncaught frontend errors (28 Canceled, 26 TypeError, 19 JSON Parse error).
- 2098 KaTeX strict-mode warnings crossing the JS->native bridge.
- 68.7 MB of logs written today; app.log rotates 10 MB every ~4 h.
- Render RSS 1.17 GB (peak 2.3 GB), main footprint 699 MB (peak 1.7 GB) after 66 h. A bigger DOM means a bigger layer tree.
Impact
A visible window costs 5-8 W more than minimized: 30-40% of total system load, roughly 42 Wh per 8 h working day (about half a battery).
Reproduction
- Apple Silicon, OpenBitFun 1.0.7, ProMotion display, window maximized.
- Open a long conversation until render RSS exceeds ~1 GB.
- Send a message and let the agent stream.
- sudo powermetrics --samplers cpu_power,gpu_power -i 1000 -n 10 -> GPU pinned at 5-8 W.
- Minimize -> GPU below 0.1 W within one sample; restore -> returns to the pinned level.
Suggested directions
- Batch streamed text into ~10 Hz DOM commits instead of a drawing-area frame cycle per token.
- Audit promoted compositing layers (backdrop-filter, will-change, transform, shadow) in message bubbles and highlighting.
- Check for a persistent infinite animation keeping the compositor awake.
- Rate-limit the GitStateManager refresh and manage_dialog_queue retry, and reap git children.
- Virtualize the message list so DOM and layer count do not scale with conversation length.
- Offer a reduce-effects / low-power setting.
Happy to run an instrumented build or provide further sample/powermetrics captures.
- 主要语言
- Rust
- 星标
- 2.3k
- 派生
- 236
- 平均合并
- 5 小时 18 分钟
- 30 天内合并 PR
- 271
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
GCWing/OpenBitFun 的其他 Issue
-
[Feature]: 模型服务表单缺少「图像生成」分类入口 —— 后端已支持 default_models.image_generation可能已有人在做 @skyfireitdiy 于 14 天前认领。 未关闭
难度 2/5 半天 新手友好度 74/100
GCWing/OpenBitFun#3279 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
GCWing/OpenBitFun#2363 ·
维护者通常 1 天内回复
-
question
难度 1/5 1 小时以内 新手友好度 78/100
GCWing/OpenBitFun#2340 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 55/100
GCWing/OpenBitFun#3572 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
GCWing/OpenBitFun#3559 ·
维护者通常 1 天内回复
查看 GCWing/OpenBitFun 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
o8 next debug build aborts on Glass to Dark appearance switch (nil identifier messaged before check)未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
hurttlocker/o8#5112 ·
-
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
memory_patch_page drops the `#` of headings like `## Notes on C#`可能已有人在做 @viniciusdsandrade 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
akitaonrails/ai-memory#1859 ·
维护者通常 1 天内回复