مشخصات کتاب
-
Gaurav Vaish
-
2016
-
انگلیسی
-
27110
-
890
-
0
High-Performance iOS Apps
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Part I. Getting Started
1. Performance in Mobile Apps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Defining Performance 3
Performance Dimensions 4
Memory 4
Power Consumption 4
Initialization Time 4
Execution Speed 5
Responsiveness 5
Local Storage 6
Interoperability 7
Network Condition 7
Bandwidth 8
Data Refresh 9
Multitenancy 9
Single Sign On 10
Security 10
Crashes 11
Project: High Performance 11
Case Study: vCircle 12
Summary 13
2. Measuring Performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Parameters and Measurement 15
Memory 15
Stack size 15
Heap size 16
Object longevity and leaks 17
Response Time 18
Execution Time 18
Network Usage 18
Battery Consumption 19
Disk Storage 19
Backup Size 19
Crashes 19
App Usage 19
Profiling 20
Code Setup 20
Testability 21
Traceability 21
Crash Reporting 21
Instrumentation 22
Logging 26
Summary 29
Part II. Core Optimizations
3. Memory Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Memory Management Model 33
Auto-Releasing Objects 35
Autorelease Pool Blocks 37
Automatic Reference Counting 40
Rules of ARC 41
Reference Types 43
Strong Reference 43
Weak Reference 43
Variable Qualifiers 43
Property Qualifiers 44
Getting Hands Dirty 45
Rules of Memory Management 51
Retain Cycles 52
Rules to Avoid Retain Cycles 53
Common Scenarios for Retain Cycles 54
Delegate 54
Block 60
Thread and Timer 61
Observer 66
Returning Error 70
Properties and Instance Variables 71
Weak Type - id 72
Problem 73
Solution 74
Singletons 75
Finding Mystery Retains 76
Best Practices 77
Zombies 78
Xcode Setup 78
Memory Usage in Production 79
Summary 80
4. CPU, Power and Battery Consumption. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
What constitutes power consumption? 81
CPU 82
Network 83
Location Manager and GPS 86
Optimal initialization 88
Turn On iff essential 90
Network iff essential 90
Background Location Service 91
NSTimers, NSThreads and Location Services 92
Restart after app kill 93
Screen 93
Animation 94
Video Play 94
Multiple Screens 94
Other hardware 99
Battery Level and State aware code 99
Analyzing CPU usage using Xcode 101
Tracking Performance Monitor Counters 102
Energy Diagnostics Trace Template 102
Best Practices 102
Summary 104
5. Concurrent Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Threads 105
Costs of Threads 106
Kernel Data Structures 106
Stack Size 106
Creation Time 107
GCD 108
Operations and Queues 109
Tools for Threads 111
Multicore trace template for Thread Usage 111
Time Profiler trace template Core Usage 111
Thread Safe Code 111
Use atomic properties 112
Use synchronized code blocks 113
Use Reader-Writer locks for concurrent reads and writes 115
Use immutable entities 117
Have a central state updater service 121
State observers and notifications 127
Prefer Async over Sync 132
Summary 134
Part III. iOS Performance
6. Application Lifecycle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
App Delegate 137
Application Launch 140
First Launch 142
Cold Start 150
Warm Launch 158
Push Notifications 161
Background Fetch 165
Summary 167
7. User Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
View Controller 170
View Load 173
View Hierarchy 174
View Visbility 176
View 179
UILabel 181
UIButton 183
UIImageView 184
UITableView 185
UIWebView 189
Custom Views 193
Auto Layout 199
Size Classes 201
New Interaction Features in iOS 8 206
Interactive Notifications 206
App Extensions 207
Summary 211
8. Network. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
KPI and Measurement 213
DNS Lookup Time 214
SSL handshake time 216
Network Type 217
Latency 223
App Deployment 226
Servers 226
Request 227
Data Format 229
Tools 230
Network Conditioner 230
AT&T Application Resource Optimizer 232
Charles Proxy 234
Summary 239
Learn cocos2D Game Development with iOS 5
Learn cocos2D Game Development with iOS 5
نویسنده: Steffen Itterheim, Andreas Löw
زبان: انگلیسی