Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Swift warm up NSUUID
Johnlin
September 04, 2018
Programming
0
58
Swift warm up NSUUID
Johnlin
September 04, 2018
Tweet
Share
More Decks by Johnlin
See All by Johnlin
Ruby 型別檢查工具簡介
johnlinvc
0
48
Swift Actor 實作探索
johnlinvc
0
99
用 mruby 來寫跨平台工具
johnlinvc
0
30
Actor model 簡介
johnlinvc
0
62
一起玩 Helm 3
johnlinvc
1
51
為什麼 App 卡卡的
johnlinvc
2
870
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
93
Life of a Cell
johnlinvc
0
1.2k
Swift weekly 2018/09/04
johnlinvc
0
55
Other Decks in Programming
See All in Programming
Rに管理されてみる
kazutan
0
250
SGGとは
inoue2002
0
430
Efficient UI testing in Android
alexzhukovich
1
120
設計の考え方とやり方
masuda220
PRO
48
26k
How GitHub Supports Vim License Detection, The Five Years Journey
othree
1
340
ECサイトの脆弱性診断をいい感じにやりたい/OWASPKansaiNight_LT1_220727
owaspkansai
0
290
パスワードに関する最近の動向
kenchan0130
1
320
「困りごと」から始める個人開発
ikumatadokoro
4
250
それ全部エラーメッセージに書いてあるよ!〜独学でPHPプログラミングが上達するたった一つの方法〜
77web
1
150
Better Angular Architectures: Architectures with Standalone Components @DWX2022
manfredsteyer
PRO
1
380
Google I/O 2022 Android関連概要 / Google I/O 2022 Android summary
phicdy
0
370
YATA: collaborative documents and how to make them fast
horusiath
1
150
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
15
980
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
119
28k
What’s in a name? Adding method to the madness
productmarketing
11
1.6k
The Illustrated Children's Guide to Kubernetes
chrisshort
18
40k
Building Your Own Lightsaber
phodgson
95
4.7k
Bootstrapping a Software Product
garrettdimon
296
110k
GitHub's CSS Performance
jonrohan
1020
420k
Building Better People: How to give real-time feedback that sticks.
wjessup
344
17k
The Invisible Customer
myddelton
110
11k
What's in a price? How to price your products and services
michaelherold
229
9.4k
Unsuck your backbone
ammeep
659
55k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
269
12k
Transcript
Swift ఔࣜখ NSUUID John Lin
ॄኄੋ UUID • ௨༻།Ұࣝผᛰ(Universally Unique Identifier) • 550e8400-e29b-41d4-a716-446655440000 • 32
ݸ16 ਐҐᏐ= 16byte = 128 bitɼ༗ 3.4 * 10 ^ 38 छ߹
UUID ֨ࣜ • xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx • ࣈᏐత֨ࣜੋ 8-4-4-4-12 • ଖதၷݸํੋ༻ိදࣔ൛ຊతɻ
UUID ൛ຊ • લ༗ޒݸ൛ຊɼၷछᏓᱪɻ • ࠷ৗ༻తੋ 1 4
UUID1 • timestamp (60 bit) + clock_seq(14bit) + version(6bit) +
MAC address(48bit) = 128bit • ࣌ؒੋኺ 1582/10/15T00:00 ։࢝ࢉʢެ㑕։࢝)ɼ 㑌100 ns ࢉҰݸᄸҐ
UUID 䉰 • timestamp (60 bit) + clock_seq(14bit) + version(6bit)
+ MAC address(48bit) = 128bit • ࡏಉҰػث্ɼ100 ಸඵ㚎ᬋػతൣᅴ༗ 14 bit ༗త࣌ީ။㗞ੜҰᒬతUUIDɼҝ䉰
ੜዬ • Ұݸ൝্༗ࡾेݸਓɼ༗ࢸগၷݸਓಉҰఱੜతػ ੋଟগ䏆ʁ • (1/365)^30 ?
ੜዬ • Ұݸ൝্༗ࡾेݸਓɼ༗ࢸগၷݸਓಉҰఱੜతػ ੋଟগ䏆ʁ • ਖ਼֬తࢉ๏ੋ༻ 1 ݮᎃશᔒ༗ॏෳతػɻब ੋ •
ࡏ 30 ݸਓతگԼେੋ 70 %
UUID1 䉰 • timestamp (60 bit) + clock_seq(14bit) + version(6bit)
+ MAC address(48bit) = 128bit • ࡏಉҰػث্ɼ100 ಸඵ㚎ᬋػతൣᅴ༗ 14 bit ༗త࣌ީ။㗞ੜҰᒬతUUIDɼҝ䉰 • ༻ੜዬɼ100 ಸඵ㚎㗞ੜ 18 ݸ UUID ब༗ 1 % తػ။䉰ɼෆଠద߹շ༻
UUID4 • Swift 㚎ݐత NSUUID & UUID ༗ UUID4 •
random (122 bit) + version (6bit) = 128 bit • 䉰తػখଟ • 㗞ੜ 103 ஹݸ UUID4 ။༗ 10ԯ೭Ұతػ။䉰
NSUUID
UUID • ޭೳ NSUUID Ұᒬɼෆաੋ Struct ൛తɻ • ݐٞ༻Ṝݸൺֱ҆શɻ
݁ • UUID 4 䉰తػᕝత • ༗धཁᘐಛ ID త࣌ީब༻㠧ɼൺࣗݾrandom ؆
ᄸɻ
Q&A
፮ᐔػ • http://slot.miario.com/machines/150067