Flutter 的新功能、Dart 開發工具以及一行神奇的 CSS 代碼 | Google 開發者大會見聞

{"type":"doc","content":[{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2020 年 11 月 16 日,Google 開發者大會 (Google Developer Summit) 在線上舉行。本次大會以“代碼不止”爲主題,全面介紹了產品更新以及一系列面向本地開發者的技術支持內容。11 月 18 日,進行了以 Flutter 爲主題的演講,本文重點關注了 Flutter 性能方面的進展以及一些新功能。"}]}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"Flutter 性能進展"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2019 下半年,共收到 23 個量化的性能提升;2020 上半年,共收到 27 個量化的性能提升。2020 上半年共收到來自 78 位開發者的 49 個性能改進。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"工具的性能十分重要,性能測試也同樣至關重要,擁有良好的性能測試可以:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"快速重現問題;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"迭代和驗證解決方案;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"提供數據,激勵進一步的工作並防止倒退。"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"能耗與速度相關,每一幀渲染時間越長,能耗就越高,但能耗並不等於速度,因爲在某些情況下,渲染速度快可能會導致能耗升高;渲染速度慢也可能不耗能。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"CPU 上運行時間雖然短,但由於新的算法利用了更多的 GPU 核心,所以 GPU 能耗反而增加;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"有些 CPU 上的任務被別的 I\/O 或 GPU 任務阻塞,進行了長時間的等待,而等待的時間內並無過多能耗。"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"因此,在速度之外增加的能耗測試是十分必要的。因爲 Flutter 團隊在 GitHub 上收到的大部分能耗問題都和 iOS 相關,所以,此次 Flutter 首先加入了 iOS 的能耗測試,Android 的能耗測試工具會於後續加入。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"開發者可以使用 Flutter Gallery App 在 Timeline 中查看 CPU\/GPU 的使用率,也可以用集成測試自動檢測 CPU\/GPU 的使用率。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Flutter 還新加入了 SkSL 着色器編譯預熱功能,來幫助開發者消除着色器編譯卡頓。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章