Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Performance Optimization for iOS Apps
Search
Vitalii Topoliuk
August 14, 2013
Programming
3
86
Performance Optimization for iOS Apps
Tips & Tricks from personal experience.
Vitalii Topoliuk
August 14, 2013
Tweet
Share
More Decks by Vitalii Topoliuk
See All by Vitalii Topoliuk
Responsive UI for iOS Apps
vtopoliuk
5
430
Other Decks in Programming
See All in Programming
役立つログに取り組もう
irof
27
8.7k
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
920
Progressive Web Apps für Desktop und Mobile mit Angular (Hands-on)
christianliebel
PRO
0
110
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
7
2.8k
EventSourcingの理想と現実
wenas
6
2.1k
Vitest Browser Mode への期待 / Vitest Browser Mode
odanado
PRO
2
1.7k
Importmapを使ったJavaScriptの 読み込みとブラウザアドオンの影響
swamp09
4
1.2k
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
430
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
350
Identifying User Idenity
moro
6
7.9k
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
430
Dev ContainersとGitHub Codespacesの素敵な関係
ymd65536
1
130
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.6k
Become a Pro
speakerdeck
PRO
24
5k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Why You Should Never Use an ORM
jnunemaker
PRO
53
9k
How GitHub (no longer) Works
holman
311
140k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
328
21k
Fireside Chat
paigeccino
32
3k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
It's Worth the Effort
3n
183
27k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
What's new in Ruby 2.0
geeforr
342
31k
Transcript
Performance Optimization Vitalii Topoliuk @vtopoliuk
- Performance scenarios - How to measure performance - How
to improve key scenarios - Tips and Tricks Contents:
- Not just about speed - CPU tasks - Memory
- Rendering - File I/O - Networking - Power Performance Performance scenarios
- Not just about speed - CPU tasks - Memory
- Rendering - File I/O - Networking - Power Performance Performance scenarios
Overall recommendations Performance scenarios - Don’t guess, just measure -
Measure on slowest device - Measure on pessimistic data - Measure on real data
How to measure Performance scenarios - Instruments - Logging -
Quartz Debug (OS X)
CPU Performance Optimization
- Unhappy users CPU CPU Tasks Optimization
- Unhappy users - System can abort your app CPU
CPU Tasks Optimization
Time Profiler Demo CPU Tasks Optimization
CPU Tasks Optimization
CPU Tasks Optimization
- do less work - do work later - do
slow in background and use placeholders - do work faster Main strategies CPU Tasks Optimization
Memory Performance Optimization
- Crashes => Unhappy Users Memory Memory Optimization
Allocations & Leaks Demo Memory Optimization
Memory Optimization
Memory Optimization
Memory Optimization
- do less work - do work later - break
down work to smallest batches - use ARC :) - @autoreleasepool Main strategies Memory Optimization
.nib loading Tips and Tricks x10 faster
ARC vs MMM Tips and Tricks - (void)getPoints:(DPoint[2])outPoint forCenterPoint:(DPoint)centerPoint targetingVector:
(DVector)targetingVector skipEquation:(BOOL)skip lineWidth:(DFloat)lineWidth { DVector normVector = DVectorNormalVector(targetingVector); DFloat originX = centerPoint.x + (lineWidth / 2.0f) * normVector.x; ... // some code outPoint[1] = (DPoint){originX, originY}; }
ARC vs MMM Tips and Tricks x5 faster on MMM
- (void)getPoints:(DPoint[2])outPoint forCenterPoint:(DPoint)centerPoint targetingVector: (DVector)targetingVector skipEquation:(BOOL)skip lineWidth:(DFloat)lineWidth { DVector normVector = DVectorNormalVector(targetingVector); DFloat originX = centerPoint.x + (lineWidth / 2.0f) * normVector.x; ... // some code outPoint[1] = (DPoint){originX, originY}; }
Universal solutions Tips and Tricks [self.array addObject:[NSValue valueWithCGPoint:point]] xxx times
faster VS @interface DPointsCollection : NSObject - (void)addPoint:(CGPoint)point atIndex:(NSUInteger)index; - (void)removePointAtIndex:(NSUInteger)index; ... @end
Sorted NSArray Tips and Tricks [self.array addObject:object]; [self.array sortUsing...];
Sorted NSArray Tips and Tricks NSUInteger index = [self.array indexOfObject:object
inSortedRange:range options:NSBinarySearchingInsertionIndex usingComparator:comparator]; [self.array insertObject:object atIndex:index];
Delay large tasks Tips and Tricks - (void)addPerson:(DPerson*)person { ...
[self save]; // large task } - (void)addBook:(DBook*)book { ... [self save]; // large task }
Delay large tasks Tips and Tricks - (void)addPerson:(DPerson*)person { ...
[self delayedSave]; } - (void)addBook:(DBook*)book { ... [self delayedSave]; } - (void)delayedSave { [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(save) object:nil]; [self performSelector:@selector(save) withObject:nil afterDelay:0.1f]; }
API Levels Tips and Tricks - try high level API
first - then try lower level NSArray => CFArray => void* NSXMLParser => libxml
Questions & Answers Performance Optimization