Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Flickering and performance problems of layerBacked ASDisplayNodes #37

Closed
Jercik opened this issue Oct 9, 2014 · 7 comments
Closed

Flickering and performance problems of layerBacked ASDisplayNodes #37

Jercik opened this issue Oct 9, 2014 · 7 comments
Assignees
Labels

Comments

@Jercik
Copy link
Contributor

Jercik commented Oct 9, 2014

Setting "layerBacked" value to YES is recommended for performance, but I've found that in certain situations it causes ASDisplayNodes to flicker and perform additional (and unnecessary) drawing.

Here you can see flickering when presenting and dismissing view controller:
out

Only difference between two nodes is layerBacked property set to YES on right one.

I'm using long emoji string to make drawing more expensive so flickering effect is visible on simulator. On devices effect can be observed also with strings that are much less expensive to draw.

Same effect and can be observed with ASImageNode.

I can provide example project if necessary.

@appleguy
Copy link
Contributor

appleguy commented Oct 9, 2014

Jercik, thanks for reporting this! I'm surprised this is happening on the layerBacked node—I'd actually expect it to occur on the view-backed one, since when the views are removed from the hierarchy they will automatically clear their contents to save memory. This is not always the behavior you want, and so I'm actively thinking about the right API to expose this.

There is an AsyncDisplayKit call that will cause nodes to ignore UIView notifications (such as didMoveToWindow:nil, when being removed from the hierarchy, so it doesn't clear the contents). However you shouldn't be expected to do this in a bunch of places, so we need to fix this in another way.

If you can provide a sample project, that would be especially convenient. We are planning to launch the framework quite soon and I'd love to look at this tonight, tomorrow or over the weekend.

Thanks again, and feel free to ask us any other questions!

@Jercik
Copy link
Contributor Author

Jercik commented Oct 10, 2014

Thank you for quick response!

Here is example project: https://github.com/Jercik/asflickering

On layer-backed nodes, flickering is more visible and occurs more than once, but also on view backed nodes one additional redrawing and flicker is visible after dismissing presented view controller. It would be great, if there was some way to avoid this behavior.

@appleguy
Copy link
Contributor

I have a diff that should resolve this and will try to land it tomorrow once I can get it reviewed by a team member and we can test it properly. Here's the raw diff if you're compelled to poke around with it, but this should be closed out within 24hrs!

http://pastebin.com/8Ay3tWxT

@secretiverhyme
Copy link
Contributor

f7d91bb fixes this.

@appleguy
Copy link
Contributor

Indeed, fixed (verified with your test case @Jercik — very helpful, thank you!)

@Cabus
Copy link

Cabus commented Feb 3, 2016

I'm seeing this effect with version 1.9. Especially during push and pop in a UINavigationController.
However, it happens regardless of 'layerBacked'.
I tried setting 'displaySuspended'. (true in 'didExitHierarchy'. false in 'willEnterHierarchy') but that didn't help. My node consists of an ASImageNode and 2 ASTextNodes. Any further solutions for this?

@CodeEagle
Copy link

still get blink when pop back

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants