Code Monkey home page Code Monkey logo

Comments (2)

appleguy avatar appleguy commented on May 31, 2024

We are working on changing the semantics of clearing rendered content to address this. The current behavior is derived from how nodes are used in Paper, which isn't really comparable to how other apps may want to adopt them.

In Paper, two exceptional conditions are true:

  1. Essentially everything has a "working range", similar to what is implemented for ASTableView.
  2. The content, in general, is so memory intensive that in order to avoid constantly triggering memory warnings (which /cannot/ be relied upon for stable operation, as they aren't guaranteed to be sent before the app is killed), any content outside of the working range should be purged of rendered backing stores.

The easiest way to achieve this was having nodes clear their contents when removed from the hierarchy, which should work quite well in ASTableView with reasonably-set working ranges. It also works well in apps that have organic transitions between different states, rather than UIViewController pushes and pops. Of course, neither of those things are true for many other apps, so it would make more sense to require an explicit call to clear contents.

Lastly, using a system that pre-decodes images is an anti-pattern with ASDK. Such systems are typically wasteful of memory because they don't adjust according to what content is coming onscreen soon, or what content is now offscreen and no longer needed. We found that driving these decisions at the UI layer, in close reaction to what the user is currently doing, allowed us to make more careful use of memory—while also minimizing the chance that the user reaches un-rendered content.

I believe task 37 describes essentially the same thing as this, but we'll leave this one open until it is resolved.

from asyncdisplaykit.

appleguy avatar appleguy commented on May 31, 2024

Play around with the framework after the fix for issue 37 and let me know your thoughts. I believe it now implements the proper tradeoff of controlling memory usage (it should be easily possible to discard the decoded version to save memory, knowing that if the node has to be shown again, a decode cost will be paid again).

There are probably several things that could be done to better explore the right way to use AsyncDisplayKit with image download helpers, but most of them should support downloading images without doing the decoding. If you're using AsyncDisplayKit in the scenarios where it will really help your app, it seems best to me that it controls when images are decoded and you also use its -recursivelyReclaimMemory method to keep memory usage under control.

from asyncdisplaykit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.