$30 off During Our Annual Pro Sale. View Details »

Pedal to the Metal

Pedal to the Metal

For Q3 of 2018 the main goal for Core Clients team on the iOS front was to dramatically reduce the launch time of the application.

This is a presentation that narrates the story of how we got to slow startup times and goes through the nitty gritty details of how we managed to make the app launch faster (from 5+ seconds to 2- seconds).

Esteban Torres

September 24, 2018
Tweet

More Decks by Esteban Torres

Other Decks in Technology

Transcript

  1. Pedal
    TO THE
    METAL
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  2. Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  3. CONTEXT
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  4. Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  5. iOS BRANCH
    Core
    Clients
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  6. Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  7. Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  8. IMPOSSIBILITY
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  9. OVER
    5 seconds
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  10. Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  11. context
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  12. APP THEN
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  13. Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  14. APP NOW
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  15. Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  16. Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  17. MORE
    CONTEXT
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  18. Instruments
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  19. Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  20. 1. Startup OPERATIONS
    2. ViewController
    4. PROFIT??
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  21. !
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  22. MAIN THREAD
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  23. !
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  24. !
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  25. HOW ABOUT THAT
    ViewController
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  26. EVEN MORE
    CONTEXT
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  27. Mirroring
    & YOU
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  28. ⚡"
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  29. WIP
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  30. Total pre-main time: 2.0 seconds (100.0%)
    dylib loading time: 355.67 milliseconds (17.0%)
    rebase/binding time: 1.3 seconds (63.5%)
    ObjC setup time: 186.10 milliseconds (8.9%)
    initializer time: 218.53 milliseconds (10.4%)
    slowest intializers :
    libSystem.dylib : 5.52 milliseconds (0.2%)
    : 51.01 milliseconds (2.4%)
    MediaServices : 57.60 milliseconds (2.7%)
    SoundCloud : 182.43 milliseconds (8.7%)
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  31. ENTER
    STATIC
    FRAMEWORKS
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  32. Total pre-main time: 563.45 milliseconds (100.0%)
    dylib loading time: 111.39 milliseconds (19.7%)
    rebase/binding time: 151.48 milliseconds (26.8%)
    ObjC setup time: 148.33 milliseconds (26.3%)
    initializer time: 152.08 milliseconds (26.9%)
    slowest intializers :
    libSystem.dylib : 3.37 milliseconds (0.5%)
    : 46.06 milliseconds (8.1%)
    MediaServices : 25.92 milliseconds (4.6%)
    SoundCloud : 148.34 milliseconds (26.3%)
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  33. TAKEAWAYS
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  34. 1. PARALLELIZE*
    * Also with care
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  35. 2. INSTRUMENTS is your friend
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  36. 3. STATIC FRAMEWORKS*
    * Also with care
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  37. 4. ASSUME NO ill-intention
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  38. LINKS
    > Automatic's blogpost about static frameworks 1
    > Keith Smiley's LD python script 2
    > CocoaPods 1.5.0 release notes 3
    3 http://blog.cocoapods.org/CocoaPods-1.5.0/
    2 https://github.com/keith/swift-staticlibs
    1 https://blog.automatic.com/how-we-cut-our-ios-apps-launch-time-in-half-with-this-one-cool-
    trick-7aca2011e2ea
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  39. MULŢUMESC
    > Github / Twitter: @esttorhe
    > Mastodon: @[email protected]
    !
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide