Skip to content

Page-wide sweep for invisible render work, with three correctness fixes - #569

Open
whes1015 wants to merge 27 commits into
mainfrom
fix/highlights-name-the-cycle
Open

whes1015 wants to merge 27 commits into
mainfrom
fix/highlights-name-the-cycle

Conversation

@whes1015

@whes1015 whes1015 commented Sep 7, 2026

Copy link
Copy Markdown
Member

地毯式檢查所有頁面,找出「畫了但沒有人看得見」以及「每次 build 重算但結果不可能變」的開銷並修掉,同時修正過程中確認的三個行為缺陷。

三個行為修正

  • 強震監視器的 EEW 倒數切到其他分頁後從來沒停過,等於每秒喚醒一次手機。根因不是判斷式寫錯,而是沒有東西去觸發重新評估:VisibleTabScope 整個生命週期都遞同一個實例,updateShouldNotify 永遠不會觸發,consumer 必須自己訂閱。判斷式刻意只測分頁而不用 isOnScreen,否則 showDialog 會讓一個在半透明 barrier 周圍仍然看得見的 S 波倒數凍住,把過期的安全數字當成當下的值呈現。
  • 首頁面板上滑時那層模糊沒有作用在地圖上。原本用 ImageFiltered,它模糊的是自己那塊均勻的 ColoredBox child,除了外緣羽化以外什麼都沒動。改成 BackdropFilter
  • 重點整理頁在 26.2 的 build 上仍然寫著 26.1。同一個週期的重點內容是一樣的,所以改成標示週期:26.1 和 26.2 都顯示 26.x。需要真實版號的地方(更多頁的版本卡、Apple marketing version)沒有動。

效能整理

15 個檔案,全部是等價替換,沒有任何一項改變畫面上的結果。

  • 每次 build 重建但結果不可能變的:縣市清單與鄉鎮掃描(build 在搜尋框每打一個字就走過全部 368 個鄉鎮)、DateFormatRegExpCustomPainter 迴圈裡的 Paint、行星頁重複解的 Kepler。
  • 看不見卻仍在跑或仍在畫的:一個沒有任何 listener、邊框從來沒動過一次的無限 AnimationController;每次 layout 都重跑的 IntrinsicHeight;收合後仍留在樹上的 ExpansionTile 子樹;ruler tick 的 repaint boundary 與 keep-alive。
  • 多餘的層、過大的 rebuild 範圍watchselect、整頁 rebuild 收斂成 Consumer、每列一個透明 Material 收斂成整卡一個、Material(color: transparent)MaterialType.transparency
  • 解碼:bug tracker 的頭像來源常常是 1024 見方的 CDN 圖,實際畫出來最寬 30 邏輯 px,一張就是 4 MB RGBA 被 image cache 留一整個 session。改成走框架的 decode 給 target size,長邊上限 256。上限只能放在解碼不能放在 URL,因為那個字串同時是 ETag 的身分。

Review 時值得注意

  • highlight_card 兩處 ExpansionTile 拿掉了 maintainState: true,這是行為改變。PageStorageKey 保留,展開與收合的狀態一樣會記住。
  • 同一個檔案 270 行的 diff 幾乎都是反縮排造成的,實際改動是移除一層無效的 Theme(dividerColor: transparent) wrapper。
  • region_city_page 補了 didUpdateWidget:go_router 用路由 pattern(:city)當 key 而不是解析後的城市,所以 go() 或 deep link 到另一個城市會沿用同一個 State。

驗證

tool/check.sh 全數通過,測試 1796 passed、5 skipped,codegen 重跑後產物零差異,commit gate 4/4。

gate 是在 Darwin 上跑的,CI 跑 Linux,會 shell out 的測試在那邊仍然可能不同。

@whes1015 whes1015 changed the title Fix/highlights name the cycle Page-wide sweep for invisible render work, with three correctness fixes Sep 7, 2026
@lowrt lowrt added this to the v26.3 milestone Sep 10, 2026
Fix(zh-Hant): 修正重點整理頁在 26.2 上仍寫著 26.1,整個 26 週期現在都顯示 26.x
Fix(en-US): fix the highlights page reading 26.1 on a 26.2 build; it now names the whole cycle
Fix(zh-Hant): 強震監視器的 EEW 倒數卡切到其他分頁後不再每秒喚醒手機
Fix(en-US): the monitor's EEW countdown no longer wakes the phone once a second from another tab
Optimization(zh-Hant): 多個頁面不再重複計算或繪製看不見的內容,搜尋輸入、清單捲動與分頁切換都更省電
Optimization(en-US): several pages no longer recompute or repaint what nothing on screen shows, so typing, scrolling and tab switches cost less battery
Fix(zh-Hant): 首頁面板上滑時地圖真的會糊化了,之前那層模糊沒有作用在地圖上
Fix(en-US): raising the home sheet now actually blurs the map behind it
Platform: android

Optimization(zh-Hant): 地圖與首頁在 Android 上不再對地圖做毛玻璃模糊,平移與拖動雷達時間軸在低階手機上順很多
Optimization(en-US): the map and home screen stop blurring the map on Android, so panning and scrubbing the radar timeline are much smoother on low-end phones
Fix(zh-Hant): 雷達、衛星等時間軸切到還沒載過的時間點時,不再先呆等兩秒才開始載入
Fix(en-US): the radar and satellite timelines no longer sit idle for two seconds before loading a frame they have not seen yet
Optimization(zh-Hant): 平移地圖時不再每停一下就在背景讀取整段雷達快取,低階手機更不容易卡
Optimization(en-US): panning the map no longer starts a background cache read at every pause, which keeps low-end phones responsive
Optimization(zh-Hant): 強震監視器在大型地震期間不再每秒六十次重送相同的偵測格網,手機更不發熱
Optimization(en-US): the monitor no longer re-sends an unchanged detection grid sixty times a second during a large quake, so the phone runs cooler
Optimization(zh-Hant): 首頁天氣背景每一幀不再重算不會變的光照、太陽與雨滴資料,低階手機更省電
Optimization(en-US): the home weather backdrop stops recomputing unchanging lighting, sun and raindrop data every frame, saving battery on low-end phones
Optimization(zh-Hant): 拖動或捲動首頁面板時不再重建整條逐時預報、天空背景與底部導覽列
Optimization(en-US): dragging or scrolling the home sheet no longer rebuilds the whole hourly forecast strip, the sky and the navigation bar
Optimization(zh-Hant): 地震回放不再每秒重送相同的偵測格網,波前更新也不再互相堆疊
Optimization(en-US): the earthquake replay no longer re-sends an unchanged detection grid or piles up overlapping wavefront updates
Optimization(zh-Hant): Meshtastic 電台狀態列切到其他頁面或背景後不再每秒喚醒
Optimization(en-US): the Meshtastic radio strip stops waking up every second while another page is on screen or the app is in the background
Optimization(zh-Hant): 天氣排行不再在每次重繪時重新排序全部測站
Optimization(en-US): the weather ranking no longer re-sorts every station on each repaint
Optimization(zh-Hant): 地圖上的 Mesh 路徑追蹤動畫每一幀不再重建路徑
Optimization(en-US): the mesh route-trace animation on the map no longer rebuilds its path every frame
Optimization(zh-Hant): 平移雷達或衛星地圖時只重新載入正在顯示的那一幀,低階手機解碼負擔降到五分之一
Optimization(en-US): panning the radar or satellite map reloads only the frame on screen, cutting tile decoding on low-end phones to a fifth
Optimization(zh-Hant): 地震速報卡片倒數時不再每秒重算顏色與本地震度估計,警報期間更省電
Optimization(en-US): earthquake alert cards stop recomputing their colour and local shaking estimate on every countdown second, saving battery during an alert
Optimization(zh-Hant): 月相頁拖動時間軸時不再重算整月的月相與下次滿月、新月
Optimization(en-US): scrubbing the moon page's timeline no longer recomputes the whole month's phases and the next full and new moon
Optimization(zh-Hant): 回報清單、伺服器狀態、更新日誌與地震報告頁不再在每次重繪時重新編譯字串規則
Optimization(en-US): the bug list, server status, changelog and report pages stop recompiling their text patterns on every repaint
Optimization(zh-Hant): 首頁切換地區的滑動動畫不再每一格重查地區名稱
Optimization(en-US): the home area-switch slide no longer looks the area name up again for every pixel of the animation
Optimization(zh-Hant): 雷達與衛星時間軸在背景暖身快取時少做上萬次字串解析,手機更不發熱
Optimization(en-US): warming the radar and satellite caches no longer parses tens of thousands of URLs one by one, so the phone runs cooler
Optimization(zh-Hant): 拖動時間軸、監視器狀態列與測站圖表每次重繪時不再重建時間格式與色彩
Optimization(en-US): the timeline, monitor status strip and station chart stop rebuilding their time formats and colours on every repaint
Optimization(zh-Hant): 強震監視器每秒的測站資料少複製一次、少解析一次,長時間開著更省電
Optimization(en-US): the monitor's once-a-second station feed is copied and parsed one time fewer, so leaving it open costs less battery
Optimization(zh-Hant): 每一次快取讀寫少做多次網址解析與整段內容複製,載入地圖圖磚與資料更省 CPU
Optimization(en-US): every cache read and write skips repeated URL parsing and whole-body copies, so loading tiles and data costs less CPU
Optimization(zh-Hant): 日誌寫入時的清理查詢不再每三秒建立一張五千列的暫存表
Optimization(en-US): the log's housekeeping query no longer builds a five-thousand-row temporary table every few seconds
Optimization(zh-Hant): 流量統計、伺服器狀態與語言設定不再每次呼叫都重建規則與查詢字串
Optimization(en-US): traffic accounting, endpoint health and the language setting stop rebuilding their patterns and queries on every call
Optimization(zh-Hant): 衛星過境預測的軌道計算量減半,開啟更快
Optimization(en-US): satellite pass prediction does half the orbital propagation, so the page opens faster
@whes1015
whes1015 force-pushed the fix/highlights-name-the-cycle branch from c41bbaa to b5ae7dc Compare September 11, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants