Closed Bug 1151703 Opened 10 years ago Closed 10 years ago

Add profiler timeline markers for HTML/XML parsing

Categories

(DevTools :: Performance Tools (Profiler/Timeline), defect)

x86
macOS
defect
Not set
normal

Tracking

(firefox40 fixed)

RESOLVED FIXED
Firefox 40
Tracking Status
firefox40 --- fixed

People

(Reporter: fitzgen, Assigned: fitzgen)

References

Details

Attachments

(3 files, 3 obsolete files)

We should have timeline markers for tracing HTML/XML parsing.
Depends on: 1145247
Attachment #8588909 - Flags: review?(bugs)
Attachment #8588910 - Flags: review?(jsantell)
Attachment #8588911 - Flags: review?(jsantell)
Comment on attachment 8588910 [details] [diff] [review] Part 2: Show XML and HTML parsing markers in the performance tool Review of attachment 8588910 [details] [diff] [review]: ----------------------------------------------------------------- r+ with rebasing changes, and using "colorName" ::: browser/devtools/shared/timeline/global.js @@ +65,5 @@ > + "Parse XML": { > + group: 1, > + fill: "hsl(39,82%,69%)", > + stroke: "hsl(39,82%,49%)", > + label: L10N.getStr("timeline.label.parseXML") As of bug 1150112, the fill and stroke properties are gone, replaced by `colorName` -- these use the theme colors, so can be for example: `colorName: "highlight-purple'` Colors currently used are here: https://developer.mozilla.org/en-US/docs/Tools/DevToolsColors They may be ugly in some scenarios now, but we're working on good themeing this release. Rebasing will give you the updated globals.js
Attachment #8588910 - Flags: review?(jsantell) → review+
Comment on attachment 8588911 [details] [diff] [review] Part 3: Add a test for HTML parsing markers Review of attachment 8588911 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/devtools/performance/test/browser.ini @@ +69,5 @@ > [browser_perf-overview-selection-01.js] > [browser_perf-overview-selection-02.js] > [browser_perf-overview-selection-03.js] > [browser_perf-overview-time-interval.js] > +[browser_perf-parse-html-markers.js] Let's change this to browser_markers-parse-html.js, for example, so we can easily point marker tests to others, maybe? We should probably figure out where we test markers maybe OUTSIDE of perf tools for others to make tests, not sure where we wound up when talking about that (for op instrumentation) ::: browser/devtools/performance/test/browser_perf-parse-html-markers.js @@ +27,5 @@ > + let { target, front } = yield initBackend(TEST_URL); > + > + const markers = yield getMarkers(front); > + debugger; > + ok(markers.some(m => m.name === "Parse HTML"), are we testing anything else on these markers? Not sure what other properties they have that would be relevant (stack?)
Attachment #8588911 - Flags: review?(jsantell) → review+
Comment on attachment 8588909 [details] [diff] [review] Part 1: Add timeline tracing markers for HTML and XML parsing So what case do you want to capture here? innerHTML and range's createContextualFragment(). The patch doesn't catch the common case when innerHTML is used for text only. See FragmentOrElement::SetInnerHTMLInternal
Attachment #8588909 - Flags: review?(bugs) → review-
Looked at all SetInnerHTML calls: FragmentOrElement::SetInnerHTMLInternal - Has a fast path where it avoids parsing HTML if for plain text, as you pointed out. I think it is fine to implicitly expose that we avoid parsing HTML when there are no tags by not emitting markers for this fast path. The slow path will be traced through nsContentUtils::ParseHTMLFragment. Exposing performance tools is all about exposing implementation, after all :) Element::SetInnerHTML - Calls FragmentOrElement::SetInnerHTMLInternal. See above. ShadowRoot::SetInnerHTML - Calls FragmentOrElement::SetInnerHTMLInternal. See above. HTMLScriptElement::SetInnerHTML - Doesn't parse HTML, just sets text content. Don't think this makes sense because we are trying to trace HTML parsing here, not setting any innerHTML. HTMLStyleElement::SetInnerHTML - This sets text content and then I think it re-parses CSS and recalculates styles and then layout. We have markers for style recalc and layout, but not for CSS parsing yet. I think we should have that, but in a different bug. Filed bug 1152097.
See Also: → 1152097
Comment on attachment 8588909 [details] [diff] [review] Part 1: Add timeline tracing markers for HTML and XML parsing Re-flagging for review based on comment 7.
Attachment #8588909 - Flags: review- → review?(bugs)
Attachment #8588909 - Flags: review?(bugs) → review+
I thought I found a bug in that I wasn't getting "Parse HTML" markers when refreshing a page, however :smaug tells me that is done off-main-thread, so I think we can punt on it until we figure out how to trace multiple threads well. Filed bug 1152416 for figuring out which events/tasks we should trace during page load.
See Also: → 1152416
Disregard comment #15, it actually is an issue with console.profile and parsing HTML.
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: