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

More Swift App Startup Time

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

More Swift App Startup Time

Avatar for giginet

giginet PRO

June 16, 2017
Tweet

More Decks by giginet

Other Decks in Programming

Transcript

  1. Agenda • ࠔ͍ͬͯΔ͜ͱ • Dynamic Linkerͱdyld 3 • LabͰฉ͍ͨ͜ͱ •

    ىಈ࣌ؒͷޮՌతͳܭଌํ๏ • LabͰੜ͖࢒Δʹ͸
  2. Φεεϝηογϣϯ • App Startup Time: Past, Present, and Future •

    https://developer.apple.com/videos/play/ wwdc2017/413/ • Optimizing App Startup Time • https://developer.apple.com/videos/play/ wwdc2016/406/
  3. $ instruments -t 'Time Profiler' -w ‘36AF1B72-C261-45BD- AE4A-6593D22F0A' ‘com.yourcompany.InitializeTimeProfiler' Instruments

    Trace Complete (Duration : 11.811208s; Output : /Users/ giginet/Desktop/InitializeTimeProfiler/instrumentscli1.trace)
  4. var info = mach_task_basic_info() var count = mach_msg_type_number_t(MemoryLayout.size(ofValue: info) /

    MemoryLayout<integer_t>.size) _ = withUnsafeMutablePointer(to: &info) { infoPointer in return infoPointer.withMemoryRebound(to: integer_t.self, capacity: Int(count)) { (machPoin return task_info( mach_task_self_, task_flavor_t(TASK_BASIC_INFO), task_info_t(machPointer), &count ) } } print(info.system_time) print(info.user_time)
  5. Total pre-main time: 307.08 milliseconds (100.0%) dylib loading time: 213.98

    milliseconds (69.6%) rebase/binding time: 39.27 milliseconds (12.7%) ObjC setup time: 25.78 milliseconds (8.3%) initializer time: 27.96 milliseconds (9.1%) slowest intializers : libSystem.dylib : 3.17 milliseconds (1.0%) libswiftCoreImage.dylib : 17.56 milliseconds (5.7%)