How to profile web workers in Chrome?

后端 未结 2 1178
旧巷少年郎
旧巷少年郎 2021-01-18 01:06

Does anyone know an easy way to profile web workers in Chrome? I found this question from last year, but unfortunately the only provided answer didn\'t work.

Is ther

2条回答
  •  迷失自我
    2021-01-18 01:56

    To profile Web Workers navigate to "Developer Tools -> Sources -> Workers" and enable the checkbox "Pause on start". Now, when you refresh the page, a popup window with an inspector for each worker will appear.

    In the inspector window navigate to the "Profiles" tab and start your profiling. Now you have to switch back to the "Sources" tab and click the "Resume script executing" icon on the right-top icon bar.

    This approach is not working for some older Chrome versions (Chrome 33 and below, compare Chromium Issue 180377) - there the inspector windows stay blank, except having a URL in the address bar. In Chrome 35 it is working for me.

提交回复
热议问题