Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only measure "base" times within ProfileMode #12821

Merged
merged 4 commits into from
May 15, 2018

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented May 15, 2018

Follow up for this comment on PR #12745. Previously I was tracking base time for all fibers, regardless of whether they were inside of a Profiler, because the place where I started the timer didn't yet know if it was in a ProfileMode.

I could move where I start/stop the timer somewhere else- where it would know- but this approach seemed simpler. It has a small potential downside of not measuring "base" time for the Profiler component itself- but I think this is okay because (1) that time should be minimal and (2) it isn't really actionable for a developer.

Questions

  • Should I remove the conditionals around stopBaseRenderTimerIfRunning? (Is it worth having them?)

Caveats

  • We pause/resume the global render timer even outside of a ProfileMode tree. This only updates a single numeric value though; it doesn't modify any attributes on a fiber.

@bvaughn bvaughn requested review from sebmarkbage and acdlite May 15, 2018 17:39
@bvaughn bvaughn force-pushed the profile-mode-part-1 branch from 34ac646 to 25c1d6a Compare May 15, 2018 17:51
@bvaughn bvaughn changed the title Don't collect base times outside of Profiler tree Don't measure "base" times unless within ProfileMode tree May 15, 2018
@bvaughn bvaughn changed the title Don't measure "base" times unless within ProfileMode tree Don't measure "base" times unless within ProfileMode May 15, 2018
@bvaughn bvaughn changed the title Don't measure "base" times unless within ProfileMode Only measure "base" times within ProfileMode May 15, 2018
@bvaughn bvaughn force-pushed the profile-mode-part-1 branch from 25c1d6a to 27706f7 Compare May 15, 2018 18:04
@@ -396,7 +396,9 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
nextChildren = null;

if (enableProfilerTimer) {
stopBaseRenderTimerIfRunning();
if (workInProgress.mode & ProfileMode) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need to conditionally stop it? Stopping something already stopped is as cheap as checking the flag, probably cheaper, right?

Copy link
Contributor Author

@bvaughn bvaughn May 15, 2018

Choose a reason for hiding this comment

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

Totally. This is why I had the question in the PR description:

Should I remove the conditionals around stopBaseRenderTimerIfRunning? (Is it worth having them?)

I was on the fence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll just back out 27706f7 😄

@bvaughn bvaughn merged commit 103503e into facebook:master May 15, 2018
@bvaughn bvaughn deleted the profile-mode-part-1 branch May 15, 2018 19:43
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.

3 participants