-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Addresses thread safety, GitHub issue #769. #855
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
Conversation
|
Looks like the android Travis CI configuration is borked: This PR builds OK and tests pass on my local macOS machine. |
See also: discussions in PR facebook#852 and facebook#786. In addition to improving thread safety, it removes 8 bytes of heap per node.
761b1d7 to
13ebc70
Compare
|
There seems to be a file missing for CI indeed, I've proposed a fix in #843. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidaurelio has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
This introduces double-digit regressions for layout calculation on ARM. I’m in favour of #852 at the moment, and will investigate whether we can remove the node counts. |
@davidaurelio do you have any figures to share, and is there any documentation on how to run the performance tests? There may be ways in which to recover the The other approach in #852 suffers from not being able to concurrently perform a layout of a given tree, and any number of cloned subtrees. This is because per-layout state is stored in each (shared) node, and the generation count is different for each layout run. (If this is not of practical concern, it could be documented as a limitation.) |
|
@jpap for context: we have an internal device lab that will run benchmarks on physical Android and iOS devices. As much as I would like everyone to be able to run benchmarks, this will not become a publicly available resource. Some numbers:
These numbers don’t reflect real-life scenarios accurately (we will get there in the coming months), but they give an indication about the performance characteristics of changes.
For now this is an acceptable limitation, and I agree that it should be documented. Shared subtrees are cloned lazily during layout calculation, and the only client making use of that is React Native. In their case, that’s thread safe, as the two highest ancestors sharing a node are never identical, and React Native treats subtrees as immutable. That being said, it would be nicer to evolve Yoga into a direction where we can separate the layout outputs from the nodes, but this involves migrating client frameworks as well, including Litho, ComponentKit, React Native, React Native Windows, and internal projects at Facebook and other companies. I think the short term goal should be to make parallel calculations on different trees possible. Apologies if I am not always super responsive on Github. I really appreciate the input, though! |
See also: discussions in PR #852 and #786.
In addition to improving thread safety, it removes 8 bytes of heap per node.