How Apple is making animations smoother in iOS 12

Posted:
in iOS edited June 2018
Users of iOS 12 may find the user interface to scroll smoother and process animations with fewer dropped frames compared to previous versions, thanks to a series of changes Apple made.

Illustration of a processor usage spike when scrolling in iOS
Illustration of a processor usage spike when scrolling in iOS


Explained during the session "What's New in Cocoa Touch" at WWDC 2018, Apple's engineers have used iOS 12 as an opportunity to fix animation issues that have plagued users over the years. The causes behind some dropped frames were discovered while the engineers were examining first-party apps, with Josh Shaffer advising of what they were, and what Apple has done to correct the issues.

For the most part, this consisted of improvements to the scheduling of tasks performed by the iOS device's processor, as well as pre-loading upcoming animations.

One identified issue related to how iOS handled data that needed to be produced as the user scrolls, such as items on a list of options in a menu, or a graphic further down a document. An API introduced in iOS 10 called Cell Pre-fetch aimed to cure this by preloading data in the background ahead of time, so it was ready to appear onscreen without delay or a large and sudden processor load.

Timeline of task scheduling following prefetch fixes
Timeline of task scheduling following prefetch fixes


Though this works well, Apple discovered times when it would still cause dropped frames during scrolling, caused through prefetch requests for data that will be used in the near future to be made at the same time as another set of data was being produced on-screen, causing a CPU bottleneck that slowed down both tasks. Apple has updated the pre-fetch API to prevent this from happening, by queueing up tasks to fetch data after the more immediately important rendering task is complete.

Another, arguably bigger, issue related to dropped frames during periods when there are relatively few tasks being carried out, namely periods when the CPU wasn't under load and could lower its clock speed to help preserve battery life. In cases where a user's action triggers a task, it was discovered the CPU was slow in responding to the extra work with an increase in its clock speed, effectively causing a bottleneck and resulting in a dropped frame.

In iOS 12, the CPU will now respond more quickly in these types of situations, and will increase to the appropriate clock speed to perform the task at a faster rate. Once completed, the CPU will reduce its clock speed down to its idling level as quickly as possible.

Graph showing resource consumption in typical Auto-layout views
Graph showing resource consumption in typical Auto-layout views


Auto-layout, Apple's framework that allows developers to define the placement of an app's content on a screen for a wide variety of different display sizes, has been updated to consume fewer resources in iOS 12. It was found the resources used by the framework could scale exponentially in a number of cases, such as when elements are nested or are dependent on the placement of other items.

Apple's optimizations in iOS 12 has significantly reduced the exponential scaling elements, cutting the impact on the CPU and GPU. While layouts where elements are placed independently of each other uses fewer resources overall, even this has seen some improvement in iOS 12 from iOS 11.

Shaffer also covered a new technique in iOS 12 that can reduce the amount of memory an app could require to perform a task, called Automatic Backing Stores.

In the example shown onstage, a photograph and a grayscale drawn image of the same size are shown to normally consume the same amount of memory, despite a considerable difference in colors and the number of bits used per pixel. Automatic Backing Store will define the memory usage of a file by the depth of the content itself, rather than treating everything equally, potentially reducing the memory usage for that element.

Apple has included these changes, as well as other performance improvements, in its developer betas for iOS 12. As the features are still actively being worked on, it is entirely possible for Apple to revert back to older methods if issues arise that cannot be fixed before the expected public release of iOS 12 in the fall.
edredsalilmulay
«1

Comments

  • Reply 1 of 35
    ericthehalfbeeericthehalfbee Posts: 4,485member
    an opportunity to fix animation issues that have plagued users over the years”

    Plagued? I don’t recall having this issue anywhere near the extent to call it a “plague”. Perhaps someone is confusing the iPhone with an Android device? ;)
    edredSpamSandwichtmayGG1racerhomie3georgie01netroxStrangeDayscornchippscooter63
  • Reply 2 of 35
    gatorguygatorguy Posts: 24,176member
    LOL. Of course, "Android!" , and the very first post....
    Whataboutism got going early.

    EDIT: IMO this thread will go off-track quickly now. 
    edited June 2018 muthuk_vanalingamnapoleon_phoneapart
  • Reply 3 of 35
    macxpressmacxpress Posts: 5,801member
    gatorguy said:
    LOL. Of course, "Android!" , and the very first post....
    Whataboutism got going early.
    Uh oh...some got offended!
    netmagetallest skilericthehalfbeeStrangeDayspscooter63doozydozenlamboaudi4watto_cobra
  • Reply 4 of 35
    gatorguygatorguy Posts: 24,176member
    macxpress said:
    gatorguy said:
    LOL. Of course, "Android!" , and the very first post....
    Whataboutism got going early.
    Uh oh...some got offended!
    Whataboutism is platform agnostic
    edited June 2018 muthuk_vanalingamdoozydozen
  • Reply 5 of 35
    I love how Apple thinks about every single detail and yet people say Android is superior.

    I CAN'T understand for the love of me, why someone want's to use a system from a company that SELLS ads for a living.

    They are obviously selling your data, it's their main revenue!
    racerhomie3willcropointwatto_cobra
  • Reply 6 of 35
    gatorguygatorguy Posts: 24,176member
    I love how Apple thinks about every single detail and yet people say Android is superior.

    *sigh* Well done Eric. 
    edited June 2018
  • Reply 7 of 35
    frantisekfrantisek Posts: 756member
    Great to know and even better to experience that in reality. Waiting few seconds to for two letters typed on keyboard is not worth of Apple. It is not like happening all the time but it happens.
    netmagewatto_cobra
  • Reply 8 of 35
    avon b7avon b7 Posts: 7,622member
    I love how Apple thinks about every single detail and yet people say Android is superior.

    I CAN'T understand for the love of me, why someone want's to use a system from a company that SELLS ads for a living.

    They are obviously selling your data, it's their main revenue!
    If Apple really thought of every single detail then users wouldn't have had to face this issue for years.

    Until relatively recently something as mundane as mail attachments was a royal pain to deal with. Until recently the camera app couldn't detect QR codes. The list is long for a company that thought about every single detail but the biggest issue your comment uncovers is that millions of Apple users use Google services .... on iOS.
    edited June 2018 muthuk_vanalingam
  • Reply 9 of 35
    Hope these changes help - I've been getting a lot of dropped frames, strange no-scroll events, and lots of lag on typing and letters showing up. On an X (but it was worse on my SE).
  • Reply 10 of 35
    I also think “plagued” is probably too strong a word, in my experience anyway.  I have only one instance where I get dropped frames, but it happens frequently.  In the Notes app, when I’m scrolling through a bulleted list I get dropped frames and sometimes the scroll jumps backward from the direction I’m scrolling in.  It’s annoying, especially when I’m holding my phone in one hand and trying to push a grocery cart with the other.

    What’s interesting is that only started after the Notes upgrade.  Prior to iOS 10 (?) I never noticed dropped frames.
    cornchip
  • Reply 11 of 35
    avon b7 said:
    I love how Apple thinks about every single detail and yet people say Android is superior.

    I CAN'T understand for the love of me, why someone want's to use a system from a company that SELLS ads for a living.

    They are obviously selling your data, it's their main revenue!
    If Apple really thought of every single detail then users wouldn't have had to face this issue for years.

    Until relatively recently something as mundane as mail attachments was a royal pain to deal with. Until recently the camera app couldn't detect QR codes. The list is long for a company that thought about every single detail but the biggest issue your comment uncovers is that millions of Apple users use Google services .... on iOS.
    I use some Google services like Maps because there are no alternatives. But I try my best not to.

    But I dig deep into their setting and turn every kind of tracking, ad customization and history possible.
    watto_cobra
  • Reply 12 of 35
    avon b7 said:
    I love how Apple thinks about every single detail and yet people say Android is superior.

    I CAN'T understand for the love of me, why someone want's to use a system from a company that SELLS ads for a living.

    They are obviously selling your data, it's their main revenue!
    If Apple really thought of every single detail then users wouldn't have had to face this issue for years.

    Until relatively recently something as mundane as mail attachments was a royal pain to deal with. Until recently the camera app couldn't detect QR codes. The list is long for a company that thought about every single detail but the biggest issue your comment uncovers is that millions of Apple users use Google services .... on iOS.
    I use some Google services like Maps because there are no alternatives. But I try my best not to.

    But I dig deep into their setting and turn every kind of tracking, ad customization and history possible.
    I’m confused. In your first post you said Apple thinks of all the details and that “people say Android is superior” but in this post you say you use Google for Maps because there are no alternatives.  There are alternatives, though. Are you using Google because you believe it to be superior to the alternatives?  I’m not sure what side you’re falling on here...
    muthuk_vanalingamwatto_cobra
  • Reply 13 of 35
    mike1mike1 Posts: 3,275member
    an opportunity to fix animation issues that have plagued users over the years”

    Plagued? I don’t recall having this issue anywhere near the extent to call it a “plague”. Perhaps someone is confusing the iPhone with an Android device? ;)
    Probably stuff that irks engineers and developers but not always obvious in the real world.
    pscooter63watto_cobra
  • Reply 14 of 35
    I wonder how much it will improve the Pro-motion 120Hz display of iPad Pros. Hopefully, smoother displays will come to iPhones very soon.
    watto_cobra
  • Reply 15 of 35
    mike1mike1 Posts: 3,275member
    I love how Apple thinks about every single detail and yet people say Android is superior.

    I CAN'T understand for the love of me, why someone want's to use a system from a company that SELLS ads for a living.

    They are obviously selling your data, it's their main revenue!
    Could always just throw more memory at the problem. That'll do it.  /s (in case it wasn't obvious)
    watto_cobra
  • Reply 16 of 35
    clemynxclemynx Posts: 1,552member
    When opening a safari tab in the background, the user still has to wait for the animation to end before being able to scroll again. This bug introduced in iOS 4 is extremely annoying. 
  • Reply 17 of 35
    tallest skiltallest skil Posts: 43,388member
    clemynx said:
    When opening a safari tab in the background, the user still has to wait for the animation to end before being able to scroll again.
    No. (tested on iOS 11.4 on an iPad Pro, in literally five seconds)
    watto_cobra
  • Reply 18 of 35
    racerhomie3racerhomie3 Posts: 1,264member
    Hope these changes help - I've been getting a lot of dropped frames, strange no-scroll events, and lots of lag on typing and letters showing up. On an X (but it was worse on my SE).
    Very strange. I haven’t noticed any on my SE.
    watto_cobra
  • Reply 19 of 35
    georgie01georgie01 Posts: 436member
    gatorguy said:
    LOL. Of course, "Android!" , and the very first post....
    Whataboutism got going early.
    Although not as relevant nowadays, Android  has traditionally not had as smooth of a UI. You may disagree that’s the case now, but you can at least address that rather than simply criticise the person on the sole basis that they criticised Android.
    StrangeDayspscooter63watto_cobra
  • Reply 20 of 35
    georgie01 said:
    gatorguy said:
    LOL. Of course, "Android!" , and the very first post....
    Whataboutism got going early.
    Although not as relevant nowadays, Android  has traditionally not had as smooth of a UI. You may disagree that’s the case now, but you can at least address that rather than simply criticise the person on the sole basis that they criticised Android.
    It is still relevant and prevalent in Android devices - particularly due to "heavily skinned Android" which is what you would get in most of the Android devices - with all the leading OEMs Samsung, Xiaomi, Huawei and BBK (Oppo and Vivo the culprits, OnePlus being an exception) opting to take the heavy skin route anyway.
    StrangeDayswatto_cobra
Sign In or Register to comment.