Open Bug 1819282 Opened 2 years ago

getBreakableLines could be faster for minified files

Categories

(DevTools :: Debugger, task)

task

Tracking

(Not tracked)

People

(Reporter: nchevobbe, Unassigned)

References

Details

Here's a profile opening a large minified file which only contains 2 lines: https://share.firefox.dev/3KIC6H9

We can see that the call to the source actor getBreakableLines method is taking almost half a second to complete on my (fast) machine.

This is because the function is quite naive, getting all the possible breakable positions, and then only extracting lines.
A solution would be to loop through the different lines and check if there's a breakable position in it, and bail out as soon as we can validate this

https://searchfox.org/mozilla-central/rev/aa3ccd258b64abfd4c5ce56c1f512bc7f65b844c/devtools/server/actors/source.js#298-308

async getBreakableLines() {
  const positions = await this.getBreakpointPositions();
  const lines = new Set();
  for (const position of positions) {
    if (!lines.has(position.line)) {
      lines.add(position.line);
    }
  }

  return Array.from(lines);
}
You need to log in before you can comment on or make changes to this bug.