Open Bug 1616139 Opened 3 years ago Updated 6 months ago

Performance issue with beautifying heavy srcdoc in iframe


(DevTools :: Inspector, defect, P2)



(Not tracked)


(Reporter: karlcow, Unassigned)


(Blocks 1 open bug, )


What were you doing?

  1. go to
  2. inspect an element
  3. try to copy outer html of the iframe element.

What happened?

CPU is spiking

What should have happened?

not sure. but it has a big perf impact.

Anything else we should know?

In Firefox nightly 75 macos

Note: the rendering of the document is a lot better in firefox than Chrome for example.

detected during

Copying the outer html of the iframe element worked fine and seemed fast for me. I was also testing on macOS, both on Firefox 74 and 75.
I did not notice the CPU spiking at all.
Would you be able to record a profile by any chance (using the new Performance panel in DevTools)?

Type: enhancement → defect
Flags: needinfo?(kdubost)

This is the profile

Hope it helps.
And indeed the memory spikes, it takes ~44s to copy.

Ah I think it's because it tries to beautify the code. So it's not that much the copy outer html which fails but just beautifying a huge document takes time.
I wonder if there would be way to improve the performance C++ beautifiers?

Flags: needinfo?(kdubost) → needinfo?(pbrosset)

Ah ok, that makes sense to me now. Flipping devtools.markup.beautifyOnCopy to true does make it reproduce for me now.
This pref makes the copy HTML features of the inspector beautify the code too. I initially had it off so didn't see a problem.
Thanks for the profile, that's very helpful.
Would you be so kind and edit comment 0 to say that this pref needs to be set to true?

Flags: needinfo?(pbrosset)
Summary: Performance issue with heavy srcdoc in iframe → Performance issue with beautifying heavy srcdoc in iframe
Priority: -- → P2
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.