Addresses thread safety, GitHub issue #769. #855
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue-769-thread-safety"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
See also: discussions in PR #852 and #786.
In addition to improving thread safety, it removes 8 bytes of heap per node.
Looks like the android Travis CI configuration is borked:
This PR builds OK and tests pass on my local macOS machine.
There seems to be a file missing for CI indeed, I've proposed a fix in #843.
@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
std::map
overhead.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!
Pull request closed