"System" in chrome javascript profiling

Viewed 121

When profiling a tool I've been building (a canvas-based graphing library), I've noticed that a majority of the time is spent in a task labeled "System" in the summary (see screenshot). I naturally want to optimize the thing that's taking the most compute, yet I can find nothing about what this task actually is. What is the system task and what causes it?

Summary tab in developer tools

Other details / things I've tried:

  • I can find nothing about it in the official documentation.
  • Can reproduce consistently, even after rebooting my computer
  • My first thought was that it was garbage collection, but that's explicitly listed in the call tree. I also rewrote my code to be more memory efficient (allocating an order of magnitude fewer objects), and the system task usage did not change.
  • I tried clicking on the grey bar in the timeline that represents the system task, hoping it would reveal more details. No dice.
  • In Firefox, there's no system task, and more idle time, though a surprisingly high amount of time is spent updating the DOM.
  • In Safari, 15% of the time is spent in javascript and essentially all of the remaining time is spent in a Paint, with no idle time.
  • In Brave, we get the exact same symptoms as Chrome (relatively low time in scripting, lots of time in "System").
  • In Chromium (rather than Chrome), symptoms are identical as expected.

I have a couple theories:

  • Maybe my code is hitting an edge case of the JIT that causes it to run too frequently.
  • Maybe I'm doing something dumb with the canvas.
  • Maybe I'll be able to fix my problem by trial and error, but while that'd be welcome it's ultimately tangential.

I want to understand what exactly the system task is and what causes it to run.

0 Answers
Related