不管是Chrome 還是 Edge Chromium
只要是使用Chromium的瀏覽器都可以使用開啟之後就會多一個JavaScript Profiler的分頁
按下Start即開始記錄
記錄完成之後會得到一個heavy的結果
可以用文字的方式看出哪個fn執行較花時間
chart結果分兩個區塊
上方可以使用滾輪縮放要檢視的範圍
也可以自由拖動改變大小
下方為圖像化排列占用的時間軸
滑鼠移上去可以看到該fn所占用的時間
一般要解效能就挑那些Aggregated total time 多的來修.
可以看到圖上cutTableInCrossPageItem就占了大約40秒中的24.29秒
所以我們就先拿它開刀.
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.
評論