Skip to content

Finding the code that is causing high CPU load in production

David Kutugata edited this page Feb 23, 2021 · 2 revisions

Steps to find the code from the CPU Profiler and a .js.map file

  1. Get the .cpuprofile file from the user. They can get that file by following this instructions.
  2. Get the extension version the user used, either from the VS Code marketplace, Azure, or build it yourself.
  3. Open the .cpuprofile file in the Edge devtools or directly on VS Code to find an identifiable function that we can find on a minimized js file.

These profilers help find the slow functions, which file they're in, and which line. In this case, the slow function is l and gets called by t.getDependencies, both on extension.js and on line 47.

DevToolsProfiler

VSCodeProfiler

Also, open it on notepad since neither Edge nor VS Code display the column the function is at. In this case, the l function is on column 256673.

NotepadProfiler

  1. Use this tool to find the file and function that causes the performance issue. Open a terminal in the folder where the .js and the .js.map file are located, and run source-map resolve <path>.js.map <line> <column>. In this case, the file in the project with the slow function is planner.js, and the function is dependencies.forEach(...).

source-map-cli

Clone this wiki locally