Skip to content

Fiber logs timing for HostRoot if logTopLevelRenders enabled - #8687

Merged
bvaughn merged 1 commit into
react:masterfrom
bvaughn:top-level-renderer-timer
Jan 21, 2017
Merged

bvaughn merged 1 commit into
react:masterfrom
bvaughn:top-level-renderer-timer

Conversation

@bvaughn

@bvaughn bvaughn commented Jan 4, 2017 •

Copy link
Copy Markdown
Contributor

Adds calls to console.time and console.timeEnd before beginning work on the top-level (HostRoot) component if ReactFeatureFlags.logTopLevelRenders is enabled.

Couple of concerns / open questions about this approach:

  • Is this equivalent (enough) to the timing information stack logs?
  • Are we concerned about timing in the case of bailouts caused by higher-priority updates? What about work that gets broken up across frames?

Update: This implementation potentially logs a single time entry for multiple roots, since workLoop calls findNextUnitOfWork which searches across roots. That's probably not what we want. Maybe we could only enable this logging when useSyncScheduling is enabled?

@bvaughn bvaughn changed the title Fiber logs timing for HostRoot if logTopLevelRenders flag enabled Fiber logs timing for HostRoot if logTopLevelRenders enabled Jan 4, 2017
@acdlite

acdlite commented Jan 4, 2017

Copy link
Copy Markdown
Collaborator

@spicyj What is logTopLevelRenders intended to measure? Time to initial render?

@bvaughn

bvaughn commented Jan 4, 2017

Copy link
Copy Markdown
Contributor Author

I think the intent is to annotate the Chrome Timeline view to make it easier to match frames to React components. Not just initial render but any updates (given that a0f88d2 added logging to ReactUpdates and ReactMount).

@sebmarkbage

Copy link
Copy Markdown
Contributor

This is really used as a FB specific feature to measure the overall initial render time when profiling.

@spicyj Does this look like the right thing we want to measure? Basically for sync/task/animation mode it will log the reconciliation time for an update to a root. For deferred work, it'll measure the time of a particular slice. Do we still need this feature for Web Speed?

I wonder if maybe we shouldn't do this for deferred priority work since those can't be measured as a single unit.

@sebmarkbage sebmarkbage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this in for parity. I'm not sure if it will always measure something we're interested in but we can revert later.

Initial stab at calling console.time/console.timeEnd for the top level component when ReactFeatureFlags.logTopLevelRenders is enabled
@bvaughn
bvaughn force-pushed the top-level-renderer-timer branch from b876fc2 to a236a1a Compare January 21, 2017 16:52
@bvaughn
bvaughn merged commit f546505 into react:master Jan 21, 2017
@bvaughn
bvaughn deleted the top-level-renderer-timer branch January 21, 2017 17:44
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
Call `console.time` / `console.timeEnd` for the top level component when `ReactFeatureFlags.logTopLevelRenders` is enabled
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
Call `console.time` / `console.timeEnd` for the top level component when `ReactFeatureFlags.logTopLevelRenders` is enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants