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
  2. Pedal to the Metal - AFTERMATH Esteban Torres • Core

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

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

  5. Sequel Esteban Torres • Core Clients @ SoundCloud • @esttorhe

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

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

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

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

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

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

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

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

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

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

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

  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
  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
  19. Over 5 seconds Esteban Torres • Core Clients @ SoundCloud

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

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

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

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

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

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

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

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

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

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

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

  31. 1. Startup Operations 2. ViewController 4. Profit?? Esteban Torres •

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

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

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

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

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

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

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

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

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

    • @esttorhe
  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%) <Redacted> : 51.01 milliseconds (2.4%) MediaServices : 57.60 milliseconds (2.7%) SoundCloud : 182.43 milliseconds (8.7%) Esteban Torres • Core Clients @ SoundCloud • @esttorhe
  42. Enter Static Frameworks Esteban Torres • Core Clients @ SoundCloud

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

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

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

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

  48. 1. Parallelize* * Also with care Esteban Torres • Core

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

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

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

    SoundCloud • @esttorhe
  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
  53. Xiè xiè · Github / Twitter @esttorhe - Mastodon @[email protected]

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

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

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

    @esttorhe