Closed
Bug 1298381
Opened 9 years ago
Closed 7 years ago
Implement Time to First Contentful Paint (TTFCP) for Telemetry/Profiler
Categories
(Core :: Layout, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox65 | --- | fixed |
People
(Reporter: Dominik, Assigned: jesup)
References
Details
(Keywords: perf, Whiteboard: [perf-tools])
Attachments
(1 file, 5 obsolete files)
|
30.77 KB,
patch
|
mattwoodrow
:
review+
smaug
:
review+
|
Details | Diff | Splinter Review |
Time to First Contentful Visual celebrates the first visible change to the screen that average users can observe. It can also be seen as the time when any "contentful" thing (text, image, SVG, non-empty canvas) is painted for the first time on the screen.
| Reporter | ||
Comment 1•9 years ago
|
||
Thread on Chromium about First Contentful Visual to confirm user's "is it happening?" question when requesting a new page: https://groups.google.com/a/chromium.org/forum/#!msg/loading-dev/NzBleQ4QP6Y/XRoR0NFQBwAJ
Chromium's planning doc: https://docs.google.com/document/d/1Owfs6arciEnWgT2-8bWCcHdYRIKRKZ0Xj8UtqRx4c3k/edit#heading=h.nwfi9zag6eyn
Thread on why these metrics are called "Visual" vs "Paint": https://groups.google.com/a/chromium.org/forum/#!topic/progressive-web-metrics/_s92zvTPblk
Updated•9 years ago
|
Keywords: dev-doc-needed
| Reporter | ||
Comment 2•9 years ago
|
||
This will be most likely merged with Time to First Meaningful Paint.
Updated•9 years ago
|
Summary: Implement Time to First Contentful Visual (TTFCVisual) → Implement Time to First Contentful Paint (TCP)
| Reporter | ||
Comment 3•9 years ago
|
||
There is a proposal about a Hero Element Timing API from Chrome team that was approved by the web-perf W3C group.
Here's the current draft of the spec: https://docs.google.com/document/d/1yRYfYR1DnHtgwC4HRR04ipVVhT1h5gkI6yPmKCgJkyQ/edit
Comment 4•9 years ago
|
||
Related, summary from TPAC: https://github.com/w3c/charter-webperf/issues/30
Comment 5•9 years ago
|
||
Clarified the minimal scope for this bug, which is only telemetry and profiler. Developer facing numbers depend on validation and spec stabilizing.
Keywords: dev-doc-needed
Summary: Implement Time to First Contentful Paint (TCP) → Implement Time to First Contentful Paint (TCP) for Telemetry/Profiler
Comment 6•9 years ago
|
||
Is this probe needed for QF? If so please tag with [qf:p1]
Flags: needinfo?(hkirschner)
Updated•9 years ago
|
Flags: needinfo?(hkirschner)
Whiteboard: [qf:p3]
Updated•8 years ago
|
Priority: -- → P3
Updated•8 years ago
|
Whiteboard: [qf:p3] → [qf:p3][perf-tools]
| Assignee | ||
Comment 7•7 years ago
|
||
Has not been tested or built yet. Needs more work on the IsContentfulPaint code per discussion in #gfx
| Assignee | ||
Updated•7 years ago
|
Assignee: nobody → rjesup
Status: NEW → ASSIGNED
| Assignee | ||
Comment 8•7 years ago
|
||
| Assignee | ||
Updated•7 years ago
|
Attachment #9018355 -
Attachment is obsolete: true
| Assignee | ||
Comment 9•7 years ago
|
||
| Assignee | ||
Updated•7 years ago
|
Attachment #9018375 -
Attachment is obsolete: true
| Assignee | ||
Comment 10•7 years ago
|
||
I'm certain the list of types getting the TYPE_IS_CONTENTFUL flag is wrong in many ways. I need to know a) which are wrong, b) if the recursive check I have is right. Also, should I revise NonBlankPaint to be FirstPaint? (and what exactly are the differences at the DisplayList level). Thanks
Attachment #9019136 -
Flags: feedback?(mstange)
Attachment #9019136 -
Flags: feedback?(matt.woodrow)
| Assignee | ||
Updated•7 years ago
|
Attachment #9018376 -
Attachment is obsolete: true
Comment 11•7 years ago
|
||
Comment on attachment 9019136 [details] [diff] [review]
Implement TimeToFirstContentfulPaint behind a pref
Review of attachment 9019136 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/painting/nsDisplayItemTypesList.h
@@ +22,1 @@
> DECLARE_DISPLAY_ITEM_TYPE(CANVAS, TYPE_RENDERS_NO_IMAGES)
This usage of CANVAS refers to the HTML <canvas> element, which I assume is what is meant by "non-white canvas". You might want manual code in DisplayListIsContentful to query the actual element and figure out the 'non-white' bit (which it doesn't appear we have code for).
The other 3 CANVAS_ types refer to the CSS conceptual canvas (see CSS2.3.1), and the flags look correct.
@@ +64,1 @@
> DECLARE_DISPLAY_ITEM_TYPE(SVG_WRAPPER, 0)
I think all the SVG types in this block should probably be considered contentful.
@@ +66,1 @@
> DECLARE_DISPLAY_ITEM_TYPE(TABLE_CELL_BACKGROUND, 0)
It looks like table cells don't have separate items for the colour and set of images, so this item represents whatever we have.
You may want to query the item itself to find out if it's going to paint images.
@@ +66,3 @@
> DECLARE_DISPLAY_ITEM_TYPE(TABLE_CELL_BACKGROUND, 0)
> DECLARE_DISPLAY_ITEM_TYPE(TABLE_CELL_SELECTION, TYPE_RENDERS_NO_IMAGES)
> DECLARE_DISPLAY_ITEM_TYPE(TABLE_BORDER_COLLAPSE, 0)
This represents all the backgrounds for an entire border-collapse table, including colours and images for each cell/row/column.
Again, may be worth trying to dig deeper to decide if it's contentful.
Attachment #9019136 -
Flags: feedback?(matt.woodrow) → feedback+
| Assignee | ||
Comment 12•7 years ago
|
||
disabled the actual check of the canvas MaybeModified state for now (also for some reason my simple test doesn't seem to get GetContext() when I ask for canvas.getContext('2d'))
Attachment #9019893 -
Flags: feedback?(matt.woodrow)
| Assignee | ||
Updated•7 years ago
|
Attachment #9019136 -
Attachment is obsolete: true
Attachment #9019136 -
Flags: feedback?(mstange)
| Assignee | ||
Comment 13•7 years ago
|
||
Works; tested with a simple canvas-only testcase
Attachment #9021963 -
Flags: review?(matt.woodrow)
Attachment #9021963 -
Flags: review?(bobbyholley)
| Assignee | ||
Updated•7 years ago
|
Attachment #9019893 -
Attachment is obsolete: true
Attachment #9019893 -
Flags: feedback?(matt.woodrow)
Comment 14•7 years ago
|
||
Can you confirm what I'm reviewing? Just the WebIDL changes?
Comment 15•7 years ago
|
||
Comment on attachment 9021963 [details] [diff] [review]
Implement TimeToFirstContentfulPaint behind a pref
Review of attachment 9021963 [details] [diff] [review]:
-----------------------------------------------------------------
Display list side looks good!
I'm sure there will be more tweaking required with the CONTENTFUL flags, and getting the canvas override and spec to match etc, but landing the infrastructure sounds like a good idea!
::: layout/painting/nsDisplayItemTypesList.h
@@ +57,5 @@
> DECLARE_DISPLAY_ITEM_TYPE(SUBDOCUMENT, TYPE_RENDERS_NO_IMAGES)
> DECLARE_DISPLAY_ITEM_TYPE(MASK, 0)
> DECLARE_DISPLAY_ITEM_TYPE(FILTER, TYPE_RENDERS_NO_IMAGES)
> DECLARE_DISPLAY_ITEM_TYPE(SVG_OUTER_SVG, TYPE_RENDERS_NO_IMAGES)
> DECLARE_DISPLAY_ITEM_TYPE(SVG_GEOMETRY, 0)
SVG_GEOMETRY is the standard svg display item, we should probably consider that CONTENTFUL too.
Attachment #9021963 -
Flags: review?(matt.woodrow) → review+
Comment 16•7 years ago
|
||
Comment on attachment 9021963 [details] [diff] [review]
Implement TimeToFirstContentfulPaint behind a pref
Canceling review pending comment 4.
Attachment #9021963 -
Flags: review?(bobbyholley)
| Assignee | ||
Comment 17•7 years ago
|
||
(In reply to Bobby Holley (:bholley) from comment #14)
> Can you confirm what I'm reviewing? Just the WebIDL changes?
Yes - though if you're willing/able to review any more of the DOM/layout changes, that's great. If not I'll hit up appropriate other peers for those.
| Assignee | ||
Updated•7 years ago
|
Attachment #9021963 -
Flags: review?(bobbyholley)
| Assignee | ||
Updated•7 years ago
|
Attachment #9021963 -
Flags: review?(bugs)
Comment 18•7 years ago
|
||
Comment on attachment 9021963 [details] [diff] [review]
Implement TimeToFirstContentfulPaint behind a pref
Review of attachment 9021963 [details] [diff] [review]:
-----------------------------------------------------------------
I'll defer to smaug, who can presumably also stamp the webidl changes.
Attachment #9021963 -
Flags: review?(bobbyholley)
Comment 19•7 years ago
|
||
Comment on attachment 9021963 [details] [diff] [review]
Implement TimeToFirstContentfulPaint behind a pref
>+ nsPrintfCString marker("Contentful paint after %dms for URL %s, %s",
>+ int(elapsed.ToMilliseconds()), spec.get(),
>+ mDocShellHasBeenActiveSinceNavigationStart ? "foreground tab" : "this tab was inactive some of the time between navigation start and first non-blank paint");
overlong line
> void
>+nsPresContext::NotifyContentfulPaint()
>+{
>+ if (!mHadContentfulPaint) {
>+ mHadContentfulPaint = true;
>+ if (IsRootContentDocument()) {
>+ RefPtr<nsDOMNavigationTiming> timing = mDocument->GetNavigationTiming();
>+ if (timing) {
>+ timing->NotifyContentfulPaintForRootContentDocument();
>+ }
>+
>+ mFirstContentfulPaintTime = TimeStamp::Now();
You just assign to this variable once but never use the value for anything.
Drop mFirstContentfulPaintTime from nsPresContext.
>-
>+ bool HadContentfulPaint() const {
Nit, { should be on its own line
> nsDisplayListBuilder::LeavePresShell(nsIFrame* aReferenceFrame,
> nsDisplayList* aPaintedContents)
> {
> NS_ASSERTION(CurrentPresShellState()->mPresShell ==
> aReferenceFrame->PresShell(),
> "Presshell mismatch");
>
>- if (mIsPaintingToWindow) {
>+ if (mIsPaintingToWindow && aPaintedContents) {
> nsPresContext* pc = aReferenceFrame->PresContext();
> if (!pc->HadNonBlankPaint()) {
> if (!CurrentPresShellState()->mIsBackgroundOnly &&
> DisplayListIsNonBlank(aPaintedContents)) {
> pc->NotifyNonBlankPaint();
> }
> }
>+ if (!pc->HadContentfulPaint()) {
>+ if (!CurrentPresShellState()->mIsBackgroundOnly &&
>+ DisplayListIsContentful(aPaintedContents)) {
>+ pc->NotifyContentfulPaint();
>+ }
>+ }
> }
I'm not super happy with checking both non-blank and contentful-paint, even if the pref isn't, but I guess it isn't too slow.
Attachment #9021963 -
Flags: review?(bugs) → review+
Comment 20•7 years ago
|
||
Minor request, but could we change the bug title to say FCP rather than TCP to avoid confusion and showing up in search results for TCP? Thanks.
Comment 21•7 years ago
|
||
Looks like the acronym is TTFCP per https://github.com/paulirish/pwmetrics/blame/cc8d5e7fb009573cc1991c029faf21d5d9e09093/readme.md#L317 -- updating summary to use that acronym.
Summary: Implement Time to First Contentful Paint (TCP) for Telemetry/Profiler → Implement Time to First Contentful Paint (TTFCP) for Telemetry/Profiler
Comment 22•7 years ago
|
||
Pushed by rjesup@wgate.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/91659baa6ddb
Implement TimeToFirstContentfulPaint behind a pref r=mattwoodrow,smaug
Comment 23•7 years ago
|
||
Backed out changeset 91659baa6ddb (bug 1298381) for nsDisplayList.h perma failures
push that caused the backout: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&resultStatus=testfailed%2Cbusted%2Cexception&classifiedState=unclassified&selectedJob=211784719&revision=91659baa6ddbb00282b9a3f9b9748cb25597c13e
failure: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&resultStatus=testfailed%2Cbusted%2Cexception&classifiedState=unclassified&fromchange=c0bef417dc8e17d6a2661075ae8db9df50480b2c&selectedJob=211767221&searchStr=windows%2C10%2Cx64%2Cdebug%2Creftests%2Cwith%2Ce10s%2Ctest-windows10-64%2Fdebug-crashtest-e10s%2Cr-e10s%28c%29
backout: https://hg.mozilla.org/integration/mozilla-inbound/rev/e88e746154edd216d2e315ead34c4d0c6205429c
Flags: needinfo?(rjesup)
Comment 24•7 years ago
|
||
Pushed by rjesup@wgate.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a10cbfd5f411
Implement TimeToFirstContentfulPaint behind a pref r=mattwoodrow,smaug
| Assignee | ||
Comment 25•7 years ago
|
||
Needed a bugfix to RDL first. Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=bf0cc200405f09cd32dcf6ac157d93fbc390cf5a
Flags: needinfo?(rjesup)
Comment 26•7 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Comment 27•7 years ago
|
||
(In reply to Daniel Holbert [:dholbert] (PTO Fri Nov 16) from comment #21)
> Looks like the acronym is TTFCP per
> https://github.com/paulirish/pwmetrics/blame/
> cc8d5e7fb009573cc1991c029faf21d5d9e09093/readme.md#L317 -- updating summary
> to use that acronym.
I too was going to side w/ Philip, as the spec has it listed as FCP as well. https://w3c.github.io/paint-timing/
But I see that Paul's comment was pretty recent.
Updated•4 years ago
|
Performance Impact: --- → P3
Whiteboard: [qf:p3][perf-tools] → [perf-tools]
You need to log in
before you can comment on or make changes to this bug.
Description
•