Page MenuHomePhabricator

SPIKE: Investigate scroll performance on Saved page list with large number of articles (e.g. 30).
Closed, ResolvedPublic

Description

Result of performance spike T124336

Make sure the saved page list can scroll smoothly when there are many items. If not, measure CPU usage to determine if there are opportunities for easy optimization to restore smooth scrolling.

Event Timeline

@JMinor might be worth looking into for 5.0 under the "performance" epic.

@JMinor @Fjalapeno @Mhurd this, along with other results from the tab-switching results in T124336 might be higher priority than some of the other memory consumption optimizations. I think these kinds of CPU usage issues are worse than memory usage because these issues are likely to impact more users and result in a worse UX. If the app consumes a lot of memory, we'll get some warnings and in extreme cases maybe even crash. If CPU use is excessive, the overall UX will be bad, and there's no "CPU usage warning" mechanism to automatically mitigate the issue.

BGerstle-WMF renamed this task from SPIKE: Investigate scroll performance on Saved page list with large number of articles (e.g. 50-100). to SPIKE: Investigate scroll performance on Saved page list with large number of articles (e.g. 30)..Feb 23 2016, 4:27 PM
BGerstle-WMF updated the task description. (Show Details)

Hi guys, I attach the trace for this profiling.
This is run on iPhone5S, iOS 9.0.2.

Every run contains these steps:

  1. Open the app.
  2. Go to SAVED articles.
  3. Scroll to bottom and scroll to top.

I detected the method that is consuming more time is animated_gif_imageNamed.
The POD AnimatedGIFImageSerialization, LINE 201, is making a method swizzling on imageNamed, replacing it for animated_gif_named.
When a saved cell is built the method updateSavedButtonStateis executed and imageNamed is called from there on the MAIN thread.

Here are some screenshots from the profiling:

T127838-animated_gif_named-2.png (658×1 px, 322 KB)

T127838-trace-animated_gif.png (198×1 px, 117 KB)

T127838-animated_gif_named.png (499×1 px, 275 KB)

T127838-updateSavedButtonState.png (908×1 px, 410 KB)

Here is the code taking more time:

LINE 201 - FILE AnimatedGIFImageSerialization.m

  • animated_gif_swizzleSelector(object_getClass((id)self), @selector(imageNamed:), @selector(animated_gif_imageNamed:)); **

LINE 214 - FILE AnimatedGIFImageSerialization.m

**+ (UIImage *)animated_gif_imageNamed:(NSString *)name attribute((objc_method_family(new))) {

NSString *path = [[NSBundle mainBundle] pathForResource:[name stringByDeletingPathExtension] ofType:[name pathExtension]];
if (!path) {
    path = [[NSBundle mainBundle] pathForResource:[[name stringByDeletingPathExtension] stringByAppendingString:@"@2x"] ofType:[name pathExtension]];
}

if (path) {
    NSData *data = [NSData dataWithContentsOfFile:path];
    if (AnimatedGifDataIsValid(data)) {
        return UIImageWithAnimatedGIFData(data);
    }
}

return [self animated_gif_imageNamed:name];

}
**

Hi team, I'm not very sure where to move this task now. I've completed the performance profiling, @JMinor @BGerstle-WMF

LGoto claimed this task.
LGoto subscribed.

Closed in iOS board grooming.