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
Swift warm up NSUUID
Search
Johnlin
September 04, 2018
Programming
0
120
Swift warm up NSUUID
Johnlin
September 04, 2018
Tweet
Share
More Decks by Johnlin
See All by Johnlin
用 MLIR 實作 一個 Ruby IR (intermediate representation)
johnlinvc
0
230
Unearth Ruby builtin Gems 發掘 Ruby 的內建 Gems
johnlinvc
0
330
Ruby 型別檢查工具簡介
johnlinvc
0
550
Swift Actor 實作探索
johnlinvc
0
180
用 mruby 來寫跨平台工具
johnlinvc
0
110
Actor model 簡介
johnlinvc
0
220
一起玩 Helm 3
johnlinvc
1
140
為什麼 App 卡卡的
johnlinvc
2
1.2k
如何使用 byebug 來除錯 Ruby 程式
johnlinvc
0
230
Other Decks in Programming
See All in Programming
Package Management Learnings from Homebrew
mikemcquaid
0
280
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
160
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
290
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
250
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
310
Go Conference mini in Sendai 2026 : Goに新機能を提案し実装されるまでのフロー徹底解説
yamatoya
0
380
CSC307 Lecture 13
javiergs
PRO
0
310
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
7
1.2k
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
310
モジュラモノリスにおける境界をGoのinternalパッケージで守る
magavel
0
2.6k
AIに仕事を丸投げしたら、本当に楽になれるのか
dip_tech
PRO
0
160
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
2
960
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
250
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
810
Done Done
chrislema
186
16k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
290
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4k
Being A Developer After 40
akosma
91
590k
BBQ
matthewcrist
89
10k
Amusing Abliteration
ianozsvald
0
120
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