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

[ASDisplayNode] -didEnterPreloadState does not need to call -layoutIfNeeded #trivial #411

Merged
merged 1 commit into from
Jul 5, 2017

Commits on Jul 3, 2017

  1. [ASDisplayNode] -didEnterPreloadState does not need to call -layoutIf…

    …Needed #trivial
    
    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).
    appleguy committed Jul 3, 2017
    Configuration menu
    Copy the full SHA
    6647f39 View commit details
    Browse the repository at this point in the history