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

F2f5f7bc8bd3bd71e51d303e9881fe78?s=128

Esteban Torres

September 24, 2018
Tweet

Transcript

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  20. 1. Startup OPERATIONS 2. ViewController 4. PROFIT?? Esteban Torres •

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

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

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

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

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

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

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

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

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

  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%) <Redacted> : 51.01 milliseconds (2.4%) MediaServices : 57.60 milliseconds (2.7%) SoundCloud : 182.43 milliseconds (8.7%) Esteban Torres • Core Clients @ SoundCloud • @esttorhe
  31. ENTER STATIC FRAMEWORKS Esteban Torres • Core Clients @ SoundCloud

    • @esttorhe
  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%) <Redacted> : 46.06 milliseconds (8.1%) MediaServices : 25.92 milliseconds (4.6%) SoundCloud : 148.34 milliseconds (26.3%) Esteban Torres • Core Clients @ SoundCloud • @esttorhe
  33. TAKEAWAYS Esteban Torres • Core Clients @ SoundCloud • @esttorhe

  34. 1. PARALLELIZE* * Also with care Esteban Torres • Core

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

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

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

    SoundCloud • @esttorhe
  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
  39. MULŢUMESC > Github / Twitter: @esttorhe > Mastodon: @esteban@mastodon.technology !

    Esteban Torres • Core Clients @ SoundCloud • @esttorhe