Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Pedal to the Metal - Aftermath

Pedal to the Metal - Aftermath

Journey SoundCloud had to undergo when improving the iOS launch times.

Esteban Torres

January 19, 2019
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. Pedal
    to the
    Metal
    -
    AFTERMATH
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

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

    View Slide

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

    View Slide

  5. Sequel
    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. Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  9. Context
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

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

    View Slide

  11. the bet
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  12. Improve
    iOS
    launch time
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  17. Check the code
    1. Grab start timestamp
    2. Grab end timestamp
    3. Diff
    4. Multiply by a 1000
    5. Send
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  18. Check the code
    1. Grab start timestamp
    2. Grab end timestamp
    3. Diff
    4. Multiply by a 1000
    5. Send
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  19. Over
    5 seconds
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  20. 7,000,000
    milliseconds
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

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

    View Slide

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

    View Slide

  23. App then
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

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

    View Slide

  25. App now
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

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

    View Slide

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

    View Slide

  28. more
    context
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

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

    View Slide

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

    View Slide

  31. 1. Startup Operations
    2. ViewController
    4. Profit??
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

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

    View Slide

  33. Main thread
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

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

    View Slide

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

    View Slide

  36. How about that
    ViewController
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  37. even more
    context
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  38. Mirroring
    & you
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

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

    View Slide

  40. What
    now !?
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  41. 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

  42. Enter
    Static Frameworks
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  43. 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

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

    View Slide

  45. Resources
    &
    Static Frameworks
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  46. Including
    Frameworks
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  47. Takeaways
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  48. 1. Parallelize*
    * Also with care
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  49. 2. Instruments is your friend
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  50. 3. Static Frameworks*
    * Also with care
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  51. 4. Assume no ill-intention
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  52. 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/swi"-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

  53. Xiè xiè
    · Github / Twitter
    @esttorhe
    - Mastodon
    @[email protected]
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

  54. We are
    hiring
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide

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

    View Slide

  56. Xiè xiè
    Esteban Torres • Core Clients @ SoundCloud • @esttorhe

    View Slide