Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ASDisplayNode] -didEnterPreloadState does not need to call -layoutIf…
…Needed #trivial (TextureGroup#411) This was originally added for ASCollectionNode and ASTableNode preloading to work as intended when nested inside of another ASRangeController-powered node. Indeed, it is still necessary to trigger layout on these UIKit-backed components in order for their own ASRangeControllers to start preparing content within them. However, unlike the comment suggests, it is *not* necessary to do this for image nodes. ASNetworkImageNode has only one .URL, and does not use the .bounds or .calculatedLayout at all during loading. Even the ASMultiplexImageNode does not use the .bounds, and the ASMapNode uses .calculatedLayout instead of .bounds. This change has important performance benefits. In particular, it avoids layouts that would occur on the main thread, often including text sizing, and also can result in redundant layout passes (even during a layout pass that triggers a node to enter the preload range, it may force its own layout early). It would be great to test this change with Pinterest to confirm its safety, but based on a full audit of the framework codebase, the only possibility that I see for a regression is if app implementations of -didEnterPreloadState make direct use of .bounds instead of .calculatedLayout (which is easy to fix).
- Loading branch information