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
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
320
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
7
1.5k
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
370
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
770
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
情報漏洩させないための設計
kubotak
4
750
Online-Dokumentation, die hilft: Strukturen, Prozesse, Tools
ahus1
0
100
Spatial Rendering for Apple Vision Pro
warrenm
0
130
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
260
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
280
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
800
php-conference-japan-2024
tasuku43
0
350
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
GitHub's CSS Performance
jonrohan
1031
460k
Mobile First: as difficult as doing things right
swwweet
222
9k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Become a Pro
speakerdeck
PRO
26
5k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Writing Fast Ruby
sferik
628
61k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
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