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

temporarily fixes printWasted abnormality #4683

Merged
merged 1 commit into from
Sep 23, 2015
Merged

temporarily fixes printWasted abnormality #4683

merged 1 commit into from
Sep 23, 2015

Conversation

jaehunro
Copy link

No longer prints wasted time for newly created DOM nodes
any feed back is greatly appreciated

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@tomocchino
Copy link
Contributor

@spicyj or @sebmarkbage, any feedback on this?

See also Jae's awesome blog posts about optimizing React perf here:
http://jaero.space/blog/react-performance-1/
http://jaero.space/blog/react-performance-2/

@sebmarkbage
Copy link
Collaborator

The mountComponent call of ReactDOMComponent also gets measured.

https://github.com/facebook/react/blob/master/src/renderers/dom/shared/ReactDOMComponent.js#L512

You could intercept it similarly to this:

https://github.com/facebook/react/blob/master/src/test/ReactDefaultPerf.js#L209

That should let you log the ID of newly mounted DOM nodes without needing to parse the HTML content. That's a bit safer. We're also actively trying to get rid of both IDs in the DOM and generating innerHTML content so that solution would help a lot.

@jaehunro
Copy link
Author

I'm not sure if you meant to actually intercept the mounts in the measure function, but I did, and it works for my test cases. Too good to be true?

@sophiebits
Copy link
Collaborator

Does it work equally well if you call _recordWrite(rootNodeID, 'mount', 0, [])? If so, I think that's a little cleaner since you don't need to introduce a separate list to track. If not, this way is okay too.

I can merge this if you squash your commits.

@jaehunro
Copy link
Author

printdom
By utilizing ReactDefaultPerf._recordWrite, it works properly but also displays the 'mount' in printDOM. This could be beneficial because it shows users which exact components are being newly mounted as opposed to setInnerHTML and having to look through args to find child id's in the markup, but the amount of table rows in printDOM could quickly get out of hand especially when considering a multitude of nested components for larger applications. Also, would the fnName be 'mount' necessarily?

@sophiebits
Copy link
Collaborator

I agree that that is pretty noisy. Let's keep it how you have it – mind squashing your commits into one?

@jaehunro
Copy link
Author

I'm having some trouble squashing my commits because I pulled and merged from upstream (facebook's repo) in between my commits. How should I go about squashing the commits?

pick myOldCommit
pick facebookCommits
pick myNewCommit

@sophiebits
Copy link
Collaborator

Try: git rebase -i upstream/master, then change all but the first line to read "squash" instead of "pick". After rebasing you'll need to force-push to your fork.

@sophiebits
Copy link
Collaborator

Looks like you figured it out.

sophiebits added a commit that referenced this pull request Sep 23, 2015
temporarily fixes printWasted abnormality
@sophiebits sophiebits merged commit 7398606 into facebook:master Sep 23, 2015
@sophiebits
Copy link
Collaborator

(Thank you!)

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.

5 participants