Skip to content

Commit

Permalink
Display how many elements that needed recaclualte style before FCP/LCP (
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore authored Jul 22, 2023
1 parent ef7bf7f commit d0f4d77
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/plugins/browsertime/default/metricsPageSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const metricsPageSummary = [
'statistics.pageinfo.domElements',
'statistics.extras.*',
'statistics.googleWebVitals.*',
'statistics.renderBlocking.*',
'statistics.android.batteryTemperature.*',
'markedAsFailure',
'statistics.browser.cpuBenchmark'
Expand Down
5 changes: 5 additions & 0 deletions lib/plugins/browsertime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ export default class BrowsertimePlugin extends SitespeedioPlugin {
run.fullyLoaded = result[resultIndex].fullyLoaded[runIndex];
}

if (result[resultIndex].renderBlocking) {
run.renderBlocking =
result[resultIndex].renderBlocking[runIndex];
}

if (result[resultIndex].info.title) {
run.title = result[resultIndex].info.title;
}
Expand Down
12 changes: 12 additions & 0 deletions lib/plugins/html/templates/url/metrics/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if browsertime
- const extras = medianRun ? pageInfo.data.browsertime.pageSummary.extras[medianRun.runIndex - 1] : pageInfo.data.browsertime.run.extras
- const custom = medianRun ? pageInfo.data.browsertime.pageSummary.browserScripts[medianRun.runIndex - 1].custom : pageInfo.data.browsertime.run.custom
- const cdp = medianRun ? pageInfo.data.browsertime.pageSummary.cdp[medianRun.runIndex - 1] : pageInfo.data.browsertime.run.cdp
- const renderBlocking = medianRun ? pageInfo.data.browsertime.pageSummary.renderBlocking[medianRun.runIndex - 1] : pageInfo.data.browsertime.run.renderBlocking

small
| |
Expand Down Expand Up @@ -182,6 +183,17 @@ if browsertime
td
a(href=baseHelpURL + 'totalBlockingTime') Total Blocking Time (TBT)
td.number #{h.time.ms(cpu.longTasks.totalBlockingTime)}

if renderBlocking && renderBlocking.recalculateStyle.beforeFCP
table
tr
th(colspan='2') First Contentful Paint info
tr
td Elements that needed recalculate style before FCP
td #{renderBlocking.recalculateStyle.beforeFCP.elements}
tr
td Time spent in recalculate style before FCP
td #{h.time.ms(renderBlocking.recalculateStyle.beforeFCP.durationInMillis)}
table
tr
th(colspan='2') Extra timings
Expand Down
11 changes: 11 additions & 0 deletions lib/plugins/html/templates/url/metrics/lcp.pug
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ if timings.largestContentfulPaint
td
b Render time
td #{h.time.ms(timings.largestContentfulPaint.renderTime)}

if renderBlocking && renderBlocking.recalculateStyle.beforeLCP
tr
td
b Elements that needed recalculate style before LCP
td #{renderBlocking.recalculateStyle.beforeLCP.elements}
tr
td
b Time spent in recalculate style before LCP
td #{h.time.ms(renderBlocking.recalculateStyle.beforeLCP.durationInMillis)}

if timings.largestContentfulPaint.id !== ''
tr
td
Expand Down

0 comments on commit d0f4d77

Please sign in to comment.