Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSpecify download priority in downloadImageWithUrl? #262
Comments
|
This is a good request @yxztj ! We'd also use such an API from AsyncDisplayKit, since it sets priorities depending on how close an image is to the screen. When a new screen loads, often there are downloads started for the Visible area, the "almost-visible" area, and the preloading area - and it would be great to be able to pass those priorities in without a separate call. Have you been able to test whether this makes a difference on how the network requests go out? There is additional overhead to the extra calls - but, does the network request start immediately or does it wait long enough that the priority calls are able to influence how the initial set of connection slots are allocated?
|
|
@appleguy Yeah I've been using ASDK to set image download priority based on node's interface state(preload, display, visible). We're using FLAnimatedImage and some other image processing so we implemented ASImageCacheProtocol/ASImageDownloaderProtocol on our own web image manager, which relies on PINRemoteImage. We're logging the _urlSessionTaskQueue operations' priority on each setPriority call. But not seeing the queuePriority property changing right after(guess the set operation is also queued in _concurrentOperationQueue) So maybe setting the initial priority on downloadImageWithUrl could reduce some work? In addition since NSOperationQueue doesn't guarantee operation with higher priority gets executed first, when we check the network requests using Charles, not seeing much performance advantage after setting download priority dynamically.. Sorry we haven't digged deep into the whole library, could be still missing something. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Currently it's not possible to set task priority when calling downloadImageWithUrl. Can we add another parameter for priority in the API, instead of setting it separately after creating the download task?
Background: We have a long tableView with lots of images, each cell contains random static image or gif image(also load it's first frame as placeholder. gif task priority is changed dynamically based on cell's state and is always lower than static images). When scrolling fast usually there would be a lot of concurrent tasks in manager's _concurrentOperationQueue. Currently changing priority would add another operation to the queue and enumerate all running tasks to find the specified download task, which takes time.