Swift warm up NSUUID

3f7d9611fc919c98512b779cde637dfc?s=47 Johnlin
September 04, 2018

Swift warm up NSUUID

3f7d9611fc919c98512b779cde637dfc?s=128

Johnlin

September 04, 2018
Tweet

Transcript

  1. Swift ఔࣜখ೤਎ NSUUID John Lin

  2. ॄኄੋ UUID • ௨༻།Ұࣝผᛰ(Universally Unique Identifier) • 550e8400-e29b-41d4-a716-446655440000 • 32

    ݸ16 ਐҐᏐ= 16byte = 128 bit૊੒ɼ༗ 3.4 * 10 ^ 38 छ૊߹
  3. UUID ֨ࣜ • xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx • ࣈᏐత֨ࣜੋ 8-4-4-4-12 • ଖதၷݸ஍ํੋ༻ိදࣔ൛ຊతɻ

  4. UUID ൛ຊ • ໨લ༗ޒݸ൛ຊɼၷछᏓᱪɻ • ࠷ৗ༻తੋ 1 ࿨ 4

  5. UUID1 • timestamp (60 bit) + clock_seq(14bit) + version(6bit) +

    MAC address(48bit) = 128bit • ࣌ؒੋኺ 1582/10/15T00:00 ։࢝ࢉʢެ㑕։࢝೔)ɼ 㑌100 ns ࢉҰݸᄸҐ
  6. UUID 䉰಍ • timestamp (60 bit) + clock_seq(14bit) + version(6bit)

    + MAC address(48bit) = 128bit • ࡏಉҰ୆ػث্ɼ100 ಸඵ㚎ᬋػతൣᅴ୞༗ 14 bit ༗త࣌ީ။㗞ੜҰᒬతUUIDɼ᜝ҝ䉰಍
  7. ੜ೔ዬ࿦ • Ұݸ൝্༗ࡾेݸਓɼ༗ࢸগၷݸਓಉҰఱੜ೔తػ ཰ੋଟগ䏆ʁ • (1/365)^30 ?

  8. ੜ೔ዬ࿦ • Ұݸ൝্༗ࡾेݸਓɼ༗ࢸগၷݸਓಉҰఱੜ೔తػ ཰ੋଟগ䏆ʁ • ਖ਼֬తࢉ๏ੋ༻ 1 ݮᎃ׬શᔒ༗ॏෳతػ཰ɻ໵ब ੋ •

    ࡏ 30 ݸਓత৘گԼେ໿ੋ 70 %
  9. UUID1 䉰಍ • timestamp (60 bit) + clock_seq(14bit) + version(6bit)

    + MAC address(48bit) = 128bit • ࡏಉҰ୆ػث্ɼ100 ಸඵ㚎ᬋػతൣᅴ୞༗ 14 bit ༗త࣌ީ။㗞ੜҰᒬతUUIDɼ᜝ҝ䉰಍ • ౟༻ੜ೔ዬ࿦ɼ100 ಸඵ㚎㗞ੜ 18 ݸ UUID ब༗ 1 % తػ཰။䉰಍ɼෆଠద߹շ଎࢖༻
  10. UUID4 • Swift 㚎ݐత NSUUID & UUID ୞༗ UUID4 •

    random (122 bit) + version (6bit) = 128 bit • 䉰಍తػ཰খ኷ଟ • 㗞ੜ 103 ஹݸ UUID4 ။༗ 10ԯ෼೭Ұతػ཰။䉰 ಍
  11. NSUUID

  12. UUID • ޭೳ࿨ NSUUID Ұᒬɼෆաੋ Struct ൛తɻ • ݐٞ༻Ṝݸൺֱ҆શɻ

  13. ݁࿦ • UUID 4 䉰಍తػ཰ᕝ௿త • ༗धཁᘐಛ ID త࣌ީब༻㠧ɼൺࣗݾrandom ؆

    ᄸɻ
  14. Q&A

  15. ፮ᐔػ • http://slot.miario.com/machines/150067