└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # iOS-Performance-Optimization 2 | This project contains foundation knowledge and highly recommended resources on optimizing your iOS application performance. 3 | Contributions are welcome 👋 4 | 5 | # Table of Contents 6 | 7 | - [Reduce App Size](#reduce-app-size) 8 | - [Reduce Build time](#reduce-build-time) 9 | - [App Launch time](#App-launch-time) 10 | - [App Runtime](#App-runtime) 11 | - [App Hang](#App-hang) 12 | - [Memory usage](#memory-usage) 13 | - [App Crash](#app-crash) 14 | - [CI](#ci) 15 | 16 | ## Reduce App Size 17 | 18 | ### Foundation knowledge 19 | 20 | - [Understand iOS App Size](https://docs.emergetools.com/docs/ios-app-size) by Emerge 21 | - [Understand static framework & dynamic framework](https://www.emergetools.com/blog/posts/static-vs-dynamic-frameworks-ios-discussion-chat-gpt) by Emerge 22 | - [Basic optimization to reduce app size](https://developer.apple.com/documentation/xcode/doing-basic-optimization-to-reduce-your-app-s-size) by Apple 23 | - [Advance optimization to reduce app size](https://developer.apple.com/documentation/xcode/doing-advanced-optimization-to-further-reduce-your-app-s-size) by Apple 24 | - [Reducing app size](https://developer.apple.com/documentation/xcode/reducing-your-app-s-size) by Apple 25 | - [Strip Binary Simple](https://docs.emergetools.com/docs/strip-binary-symbols) 26 | - [Xcode build time optimization](https://tech.autoscout24.com/blog/posts/xcode-build-time-optimization/) 27 | - [Are Android apps THAT much smaller than iOS?](https://www.emergetools.com/blog/posts/are-android-apps-really-that-much-smaller-than-ios) by Emerge 28 | 29 | ### Tools 30 | 31 | - [Emerge Tool size Analysis](https://www.emergetools.com/uploads) 32 | - [Periphery - Static analysis - Unused code detection](https://github.com/peripheryapp/periphery) 33 | - [FengNiao - Unused image detection](https://github.com/onevcat/FengNiao) 34 | - [Reaper by Emerge](https://docs.emergetools.com/docs/reaper): Dynamic analysis for Unused code 35 | - [SmallStrings by Emerge](https://github.com/EmergeTools/SmallStrings): Reduce localisation size by 80% 36 | 37 | ### Real-life example 38 | 39 | - [How Uber Deals with Large iOS App Size](https://www.uber.com/en-SG/blog/how-uber-deals-with-large-ios-app-size/) 40 | - [How 7 iOS Apps Could Save You 500MB of Storage](https://www.emergetools.com/blog/posts/7AppsThatCouldSaveYou500MB) by Emerge 41 | - [Spotify](https://www.youtube.com/watch?v=v3rYaEXzRh4) 42 | - [Make Your iOS App Smaller with Dynamic Frameworks](https://www.emergetools.com/blog/posts/make-your-ios-app-smaller-with-dynamic-frameworks) 43 | - [Manage Image Resources](https://medium.com/p/45681f475461) 44 | - [Duolingo remove 10000 lines of unused code by using Reaper](https://blog.duolingo.com/emerge-tools-reaper/) 45 | - [How the Tinder iOS App reduced the size of our localizations by 95%](https://medium.com/tinder/how-the-tinder-ios-app-reduced-the-size-of-our-localizations-by-95-using-emerge-af624d5b0ff0) 46 | 47 | ## Reduce Build time 48 | 49 | ### Foundation knowledge 50 | 51 | - [Clean build vs. Incremental build](https://emndeniz.medium.com/xcode-build-time-optimization-abee9893e4c8) 52 | - [Swift Compiler Performance](https://github.com/apple/swift/blob/main/docs/CompilerPerformance.md) by Apple 53 | - [Understanding Swift Performance](https://developer.apple.com/videos/play/wwdc2016/416/) by Apple: Understand how ARC works and how it impacts your app's performance 54 | - [Performance of value type](https://swiftrocks.com/memory-management-and-performance-of-value-types) by Swiftrocks 55 | 56 | ### Tools 57 | 58 | - [Xcode Build time Rendering](https://github.com/PaulTaykalo/xcode-build-times-rendering) 59 | - [XCMetrics](https://github.com/spotify/XCMetrics) 60 | - [Tuist](https://github.com/tuist/tuist) 61 | - Bazel 62 | - [Cocoapod binary cache](https://github.com/grab/cocoapods-binary-cache) by Grab 63 | - [Build time analyzer](https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode): Measure the time Xcode takes to compile every funcs 64 | 65 | ### Real-life example 66 | 67 | - [Grab](https://trinhngocthuyen.com/posts/tech/a-tale-of-project-build-time/) 68 | - [Gojek](https://medium.com/gojekengineering/reducing-our-build-time-by-50-835b54c99588) 69 | - [Tokopedia](https://medium.com/tokopedia-engineering/how-tokopedia-achieved-1000-faster-ios-build-time-7664b2d8ae5) 70 | - [Building faster](https://developer.apple.com/videos/play/wwdc2018/408) by Apple 71 | - [Caching SPM dependencies in CI](https://www.uptech.team/blog/swift-package-manager) 72 | 73 | ## App launch time 74 | 75 | ### Foundation knowledge 76 | 77 | - [About the app launch sequence](https://developer.apple.com/documentation/uikit/app_and_environment/responding_to_the_launch_of_your_app/about_the_app_launch_sequence) by Apple 78 | - [Cold launch vs Warm launch](https://developer.apple.com/documentation/xcode/reducing-your-app-s-launch-time#Understanding-cold-and-warm-launch): Apple 79 | - [Dynamic Linker vs Static Linker](https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/OverviewOfDynamicLibraries.html) 80 | - [Mach-O](https://medium.com/tokopedia-engineering/a-curious-case-of-mach-o-executable-26d5ecadd995) 81 | - [Dyld](https://www.emergetools.com/glossary/dyld) 82 | - [Protocol Conformance](https://www.emergetools.com/blog/posts/SwiftProtocolConformance) 83 | 84 | ### Tools 85 | 86 | - Xcode Instruments 87 | 88 | ### Real-life example 89 | 90 | - [Apple](https://developer.apple.com/documentation/xcode/reducing-your-app-s-launch-time) 91 | - [Uber](https://www.uber.com/en-SG/blog/measuring-performance-for-ios-apps-at-uber-scale/?uclick_id=50770e44-6b39-4177-9e17-b24247f0b7f6) 92 | - [Facebook Dynamic Loading](https://medium.com/@stevedao91/dynamic-loading-for-ios-6229d39a0a70) 93 | - [How Door Dash Reduced iOS App Launch Time by 60%](https://careers.doordash.com/blog/how-we-reduced-our-ios-app-launch-time-by-60/) 94 | - [Why Swift Reference Types Are Bad for App Startup Time](https://www.emergetools.com/blog/posts/SwiftReferenceTypes) - Emerge 95 | 96 | ## App Runtime 97 | 98 | ### Foundation Knowledge 99 | 100 | - [Thread explosion](https://swiftsenpai.com/swift/swift-concurrency-prevent-thread-explosion/) by SwiftSenpai 101 | - [Making efficient use of the libdispatch (GCD)](https://gist.github.com/tclementdev/6af616354912b0347cdf6db159c37057) by Apple engineer 102 | 103 | ### Tools 104 | 105 | - [os signpost](https://www.donnywals.com/measuring-performance-with-os_signpost) 106 | - [ETTrace](https://github.com/EmergeTools/ETTrace) 107 | 108 | ## App Hang 109 | 110 | ### Foundation Knowledge 111 | 112 | - [Understanding hangs in your app](https://developer.apple.com/documentation/xcode/understanding-hangs-in-your-app) 113 | - [Understand and eliminate hangs from your app](https://developer.apple.com/videos/play/wwdc2021/10258/) 114 | 115 | ### Tools 116 | 117 | - [Track down hangs with Xcode and on-device detection](https://developer.apple.com/videos/play/wwdc2022/10082/): track hangs during pre-release testing, show you how to identify issues in release builds using the Xcode Organizer 118 | - [Analyzing responsiveness issues in your shipping app](https://developer.apple.com/documentation/xcode/analyzing-responsiveness-issues-in-your-shipping-app) 119 | 120 | ## Memory Usage 121 | 122 | ### Foundation Knowledge 123 | 124 | - [You don't always need weak self](https://medium.com/@almalehdev/you-dont-always-need-weak-self-a778bec505ef) 125 | - [Nested closure weak self](https://medium.com/@almalehdev/the-nested-closure-trap-356a0145b6d) 126 | - [Detect Unused code using Memory graph debugger](https://careers.doordash.com/blog/ios-memory-leaks-and-retain-cycle-detection-using-xcodes-memory-graph-debugger/) 127 | - [Automating Memory Leak Detection with CI Integration](https://medium.com/gitconnected/automating-memory-leak-detection-with-ci-integration-for-ios-380f08a55f0b) 128 | - [Analyze Heap Memory](https://developer.apple.com/videos/play/wwdc2024/10173/): Apple WWDC 129 | - [Copy-on-write](https://holyswift.app/copy-on-write-in-swift/) 130 | 131 | ### Tools 132 | 133 | - [Memory Leaks Check](https://github.com/hoangatuan/MemoryLeaksCheck): A tool for detecting memory leak in CI 134 | - [MLeaksFinder](https://github.com/Tencent/MLeaksFinder): Hooks the dealloc method to check whether an object still exists after being released, thereby determining if there is a memory leak 135 | - [FBRetainCycleDetector](https://github.com/facebook/FBRetainCycleDetector): Traverses strong references between objects and builds a reference graph. If it detects a cycle, it indicates a retain cycle issue 136 | 137 | ### Real life examples 138 | 139 | - [The Memory Leak: An Xcode Detective Story by Emerge](https://www.emergetools.com/blog/posts/the-memory-leak-an-xcode-detective-story?utm_campaign%3DiOS%20CI%20Newsletter%26utm_medium%3Dweb%26utm_source%3DiOS%20CI%20Newsletter%20Issue%2051%26utm_content%3Dsep_23_24) 140 | 141 | ## App Crash 142 | 143 | ### Foundation Knowledge 144 | 145 | - [Diagnosing issues using crash reports and device logs](https://developer.apple.com/documentation/xcode/diagnosing-issues-using-crash-reports-and-device-logs) - A series of diagnosing crash issues by Apple 146 | 147 | ### Tools 148 | 149 | - [KSCrash](https://github.com/kstenerud/KSCrash) 150 | 151 | ## CI 152 | 153 | ### Examples 154 | 155 | - [Performance testing on CI](https://testableapple.com/xctmetric/?issue=043&utm_source=fatbobman%20weekly%20issue%2043&utm_medium=email&utm_campaign=fatbobman%20weekly) 156 | - [Selective testing](https://medium.com/trendyol-tech/selective-unit-testing-on-ios-achieve-80-faster-feedback-42e865c8ce20) 157 | 158 | 159 | --------------------------------------------------------------------------------