Enabling profiler improves performance

Greetings. Using Uncategorized since it’s not really an issue. I just want to know how is it even possible.

OS: Funtoo Linux 1.4, all latest packages.
Brave: 1.5.115
Chromium: 80.0.3987.149 (Official Build) unknown (64-bit)

  1. Installed Brave with the package manager.
  2. Opened a local file with lots of Javascript.
  3. Opened devtools (Ctrl+Shift+I) and run the script.
  4. Enabled Profiler.
  5. Run the script again.
  6. Uploaded the code to CodePEN.
  7. Run the script on CodePEN with and without the profiler.

The (milliseconds, a bit rounded up) results are:

Local CodePEN
With profiler 2100 2100
Without profiler 26000 1100

Also, if I put the CodePEN in full-page mode the results become the same as with local file. Having devtools opened without running the profiler doesn’t affect it at all so I don’t think it’s because of window size. I literally just click Record before starting the script and it becomes an order of magnitude faster. Then I disable the profiler and it becomes slow again. All without changing the window size.

If you want to test it, click the lower frame’s upper link to run the script. It does nothing but modify DOM a little bit once in a few thousand iterations, otherwise it’s busy-wait.

UPD: https://codepen.io/naryl/pen/qBdvjJE
All of the code is generated, not hand-written.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.