Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Benchmark_on_iOS
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
to4iki
October 08, 2016
Programming
220
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Benchmark_on_iOS
https://github.com/to4iki/Benchmark
to4iki
October 08, 2016
More Decks by to4iki
See All by to4iki
Claude Code の活用事例
to4iki
0
200
Swift Concurrencyを利用したUIViewController表示の排他制御の実装
to4iki
0
3.8k
ケースに応じたUICollectionViewのレイアウト実装パターン
to4iki
1
5.9k
ビューインプレッションの計測方法
to4iki
1
1.2k
秘伝の `gitconfig`
to4iki
1
470
Abema iOS Architecture
to4iki
12
3.6k
timetable-bot
to4iki
0
15k
BLoC Pattern Introduction with Swift
to4iki
2
1.4k
nel
to4iki
0
200
Other Decks in Programming
See All in Programming
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
780
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
34
15k
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
240
Java 27新機能 / Java 27 new features
kishida
2
200
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.5k
Verilogで学ぶCPU自作入門
uyuki234
8
4k
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
320
phperだってパンチカードでコーディングしたい
o0h
PRO
0
230
mrbgem 三角測量 開発
ogom
0
210
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
480
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
140
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
130
Featured
See All Featured
Exploring anti-patterns in Rails
aemeredith
4
520
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
860
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
550
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
390
The agentic SEO stack - context over prompts
schlessera
0
970
Technical Leadership for Architectural Decision Making
baasie
3
590
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Transcript
Benchmark on iOS shinjyuku.lt #2 @to4iki
୭ʁ • @to4iki • GANMA!ͱ͍͏ອը৴ͷαʔϏεΛ࡞ͬͯ ͍·͢
Agenda • ՝ • Benchmarkͱ • BenchmarkΛͱΔ
՝ • iOSΞϓϦʹ͓͍ͯϖʔδද͕͍ࣔͷΛߴ Խ͍ͨ͠
ո͍͠ͱ͜Ζࢁ • HTTP௨৴ • JSONͷσγϦΞϥΠζ • ඳը(UITableView etc..) • ը૾ؔ࿈
• etc…
ݪҼΛಛఆ͢ΔͨΊͷࡐྉ͕ ඞཁ
ܭଌ͠Α͏
None
https://developer.apple.com/jp/documentation/ToolsLanguages/Conceptual/ Xcode_Overview/Debugging/MeasuringPerformance.html
XCTest#mesure
https://developer.apple.com/reference/xctest/xctestcase/1496290-measure
͍ॴ • ͬ͘͟Γͱͨ͠ಛఆͩͱInstrumentߴػೳ ͗͢Δ => ࡉཻ͔͍Ͱݟ͍ͨࡍʹ༗ޮ • XCTest#mesuretest࣮ߦͷ࣌ͷΈ͔͠ܭଌ Ͱ͖ͳ͍
ΑΓ”ࡶ”ʹݪҼΛಛఆ͍ͨ͠
Benchmark
Benchmark • ൺֱͷͨΊʹ༻͍Δࢦඪ • ਫ४ج४ • ଌྔʹ͓͍ͯ… • ௨ৗͰಈ͔ͳ͍ҐஔΛϕϯν”ϚʔΫ”ϙΠϯ τʹఆΊͦΕΛج४ͱͯ͠ݐɺߏͷҐஔ
ΛܾΊΔ
Benchmark(Programming) • ϥΠϒϥϦͷબఆɺγεςϜߏͷܾఆͳͲʹͨͬͯɺ୭͕ೲಘ Ͱ͖٬؍తͳஅΛԼ͢͜ͱΛՄೳͱ͢ΔࠜڌͱͳΔఆྔతͳࢦඪ • ಛఆͷॲཧΛऴ͑Δ·Ͱʹ͔͔Δ࣌ؒ • ಛఆͷ࣌ؒʹॲཧͰ͖ͨճ • ϝϞϦফඅྔͷਪҠ
• σΟεΫΞΫηεͷස • etc…
func measure(f: () -> Void) { let start = CACurrentMediaTime()
f() let end = CACurrentMediaTime() print("Time: \(end - start)") } // exc measure { aswesome() }
func measure<A>(f: () -> A) -> A { defer {
print("Time: \(end - start)") } let start = CACurrentMediaTime() let result = f() let end = CACurrentMediaTime() return result } // exc let result = measure { aswesome() }
࠷ݶͷࢦඪ • nճ࣮ߦͨ͠߹ͷ • ฏۉ࣮ߦ࣌ؒ • ඪ४ภࠩ(Β͖ͭ)
to4iki/Benchmark https://github.com/to4iki/Benchmark
None
to4iki/Benchmark • Inspired by Ruby Benchmark Module • Swift3.0 •
XCTest#measureʹد͍ͤͯΔ • ؆қతͳϝτϦΫεܭଌΛߦ͏
let time = Benchmark.realTime(label: "awesome: ") { sleep(3) } print(time)
// awesome: 0.030s let metrics = Benchmark.measure(label: "[awesome]") { awesome() } print(metrics) // [awesome] // average: 0.030s // STDDEV: 4%
let n = 100000 Benchmark.bm(labels: ["total: ", "ave: "]) {
(r: Benchmark.Report) -> [TimeInterval] in let ex1 = r.time(label: "for: ") { for i in 1...n { String(i) } } let ex2 = r.time(label: "forEach: ") { (1...n).forEach({ String($0) }) } let total = ex1.elapsed + ex2.elapsed let ave = total / 2 return [total, ave] } // for: 0.027s // forEach: 0.037s // total: 0.064s // ave: 0.032s
ͬͯΈͨ • ࣮ϓϩμΫτͷܭଌʹ༻ • ·ͩ·͍ͩʹ͍͘ൃݟ
• ϓϩμΫγϣϯίʔυʹϏδωεཁ݅Ҏ֎ͷ ίʔυΛຒΊࠐΈͨ͘ͳ͍ͷͰ • AOPͰܭଌ༻ͷϩάग़ྗΛ͍ͨ͠ (http://qiita.com/xaatw0/items/ 5876afa418d4b6467e4e) • ଌఆͷ։࢝ͱऴྃͷ໌ࣔతͳίϯτϩʔϧ
·ͱΊ • ·ͣ”ࡶ”ʹ”ܭଌ”(ݱঢ়ΛѲ͢ΔͨΊ) • ͦͷ͋ͱʹৄࡉΛ֬ೝ • ϕϯνϚʔΫΛऔΔࡍʹͲͷ؍ʹண͢Δ ͔Λ͖ͬΓͤ͞Α͏
Any Questions?
(͓·͚) Ͳ͏͍ͬͨνϡʔχϯάΛߦ͔ͬͨ • σʔλؒ௨৴ʹMessagePackΛ༻ͯ͠Έͨ • ίετʹରͯ͠ϖΠ͠ͳ͍ͷͰෆ࠾༻ • ࠶ඳըΛݮΒ͢Α͏ʹλΠϛϯάௐ • ߴ͞ܭࢉճస࣌ͷϩδοΫΛվम
• ಓʹίπίπͱϨΠΞτఆٛݟ͠