Upgrade to Pro — share decks privately, control downloads, hide ads and more …

jsconf.eu x Node Collaborators Meetup journey

jsconf.eu x Node Collaborators Meetup journey

東京Node学園26時限目で飛び入りLTで発表した資料です。

D76231a2114896dfcc7b79ac69558b79?s=128

Yosuke Furukawa
PRO

June 28, 2017
Tweet

Transcript

  1. Node Collaborators Meetup & JSConf.EU 2017/06/28 NodeֶԂ 26

  2. None
  3. None
  4. None
  5. ໘ന͔ͬͨ࿩ 3ͭ঺հ

  6. 1. How to save

  7. 2017೥ݱࡏɺύεϫʔυΛͲ ͏΍ͬͯ҆શʹอଘ͢Δ͔

  8. ύεϫʔυͲ͏΍ͬͯอଘ͠ ͯ·͔͢ʁ ฏจͰอଘͯ͠ΔΑʔͬͯ ਓʁʁʁ

  9. ύεϫʔυͲ͏΍ͬͯอଘ͠ ͯ·͔͢ʁ ฏจͰอଘͯ͠ΔΑʔͬͯ ਓʁʁʁ ࢮܐ

  10. ύεϫʔυͲ͏΍ͬͯอଘ͠ ͯ·͔͢ʁ ͪΌʔΜͱϋογϡԽͯ͠· ͢Αʔʂ md5 Ͱʂʂʂʂ

  11. ύεϫʔυͲ͏΍ͬͯอଘ͠ ͯ·͔͢ʁ ͪΌʔΜͱϋογϡԽͯ͠· ͢Αʔʂ md5 Ͱʂʂʂʂ ࢮܐ

  12. Ͱ΋ਖ਼௚ʹݴͬͯʁ ͜Ε΍ͬͪΌͬͨ͜ͱ͋Δਓ ͍ͳ͍ʁʁʁ

  13. ๻Ͱ͢Ͷʂʂʂʂʂ (ϗϏʔϓϩδΣΫτ)

  14. ͜ΕΒͷϋογϡؔ਺͸
 ύεϫʔυϋογϡͱͯ͠
 ;͞Θ͘͠ͳ͍
 md5/sha1/sha256

  15. ύεϫʔυอଘ͢Δ࣌ͷ ϋογϡؔ਺͸ ҉߸తϋογϡؔ਺ͱ ݺ͹ΕΔ΋ͷ
 bcrypt/pbkdf2/scrypt

  16. CDSZQUJTTUJMMTFDVSFJO CVUBSHPOXPOJO1BTTXPSE )BTI$POUFTU

  17. ҉߸తϋογϡؔ਺͸ฒྻ࣮ ߦՄೳͳճ࿏ͰҰؾʹԋࢉ͞ ΕΔͱղಡͰ͖ͪΌ͏͔΋ʁ
 (Ex: GPU, FPGA)

  18. ͦ͜Ͱ Argon2 Password Hash Competition Ͱ༏উͨ͠ϋογϡؔ਺ɺ ݱࡏ࠷ڧ?ͷ͸ͣɻ

  19. Α͘Θ͔Βͳ͔ͬͨͬͯਓʁ

  20. ҆৺ͯ͠Լ͍͞ʂʂʂ

  21. OQNJTFDVSFQBTTXPSE ͜Ε͚֮ͩ͑ͯΕ͹͍͍Ͱ͢ʂ

  22. None
  23. JavaScript͕Ͳ͏΍ͬͯಈ͍ ͍ͯΔ͔ͱ͍͏࿩

  24. ͦ΋ͦ΋JavaScriptͬͯͲ͏ಈ ͍ͯΔͷʁ த਎͸C++Ͱbytecodeੜ੒ͯͨ͠Γ͢Δ

  25. JIT (Hidden Class) 0QUJNJ[BUJPOͱݺͿ

  26. ͨͩ͠ var obj = { x: 1, y: 2, };

    // obj ͷ y propΛফ͢ delete obj.y; // obj ʹ z propΛ଍͢ obj.z = 3; // obj ͷ props Λ֬ೝ͢Δ obj.hasOwnProperties ͜͏͍͏͜ͱ΍Δͱ஗͍
  27. ͨͩ͠ var obj = { x: 1, y: 2, };

    // obj ͷ y propΛফ͢ delete obj.y; // obj ʹ z propΛ଍͢ obj.z = 3; // obj ͷ props Λ֬ೝ͢Δ obj.hasOwnProperties ͜͏͍͏͜ͱ΍Δͱ஗͍ ͜ΕΛ%FPQUJNJ[BUJPOͱݺͿ
  28. JSͷத਎ͷಈ͖ɹ

  29. V8͸͜͏

  30. V8͸͜͏

  31. DEMO function deopt(obj) { return obj.x; } for (var i

    = 0; i < 1000000; i++) { deopt({ x: 1, y: 2}); } // deoptimized… deopt({ x: 1, y: 2, z: 3});
  32. ͋ͱ։ൃऀ޲͚ʹ͸͜ͷΦϓγϣ ϯΛ཈͓͑ͯ͘ͱΠφϑ

  33. OK͜ΕͰɺJSͷίʔυ͸Α Γߴ଎ʹͳΔ͸ͣɻ

  34. Ͱ΋ɾɾɾ

  35. ࠓޙ໰୊ʹͳͬͯ͘Δॴ

  36. Parseॲཧ

  37. Parseॲཧ

  38. Parseॲཧ • Parseॲཧͷ໨త͸Ͱ͖Δ͚ͩૣ͘จ๏Τϥʔ Λ఻͑ͯASTʹม׵͢Δ͜ͱ

  39. Parseॲཧ • v8ͷParser͸࣮͸2ͭ͋Δ • Eager Parser: • ίϯύΠϧ͍ͨ͠શͯͷؔ਺Λύʔε͢ΔͨΊʹ࢖ΘΕΔ • AST

    ߏங͕ϝΠϯλεΫ • JSͷscopeΛߏங͠ɺESSpecʹԊͬͨશͯͷsyntaxΤϥʔΛݟ͚ͭΔ • Lazy Parser: • ίϯύΠϧͨ͘͠ͳ͍ؔ਺ͷύʔεΛεΩοϓ͢ΔͨΊʹ࢖ΘΕΔ • AST͸ߏங͠ͳ͍ • ൑அՄೳͳsyntaxΤϥʔͷΈݟ͚ͭΔɺESspecʹ͸ඞͣ͠΋ԊΘͳ͍
  40. Parseॲཧ • ʮॳظஈ֊Ͱ͸ Lazy Parser ʹ࢓ࣄͤͯ͞ޙ൒ʹ Eager Parser ʹ࢓ࣄͤ͞Δʯͱ͍͏উෛ •

    Lazy Parse ͢Δͷ͔ Eager Parse ͢Δͷ͔͸ V8 ͷؾ ෼࣍ୈͰܾ·Δ΋ͷ͕ଟ͍(Heuristic) • ຊ౰ʹStartup࣌ʹඞཁͳ΋ͷ͚ͩEager Parseͤ͞ ͯɺଞ͸Lazy Parse ͍ͤͨ͞
  41. Optimize.js • https://github.com/nolanlawson/optimize-js • optimize.js ͸͜ͷ Eager Parse Λແཧ໼ཧ Lazy

    Parseʹ͢ΔͨΊͷtranspiled optimizer
  42. Optimize.js ͜Μͳײ͡Ͱແཧ໼ཧ-B[Z 1BSTFͤ͞ΔͨΊͷ ώϯτΛ༩͑Δ

  43. Α͘Θ͔Βͳ͔ͬͨͬͯਓʁ

  44. ҆৺ͯ͠Լ͍͞ʂʂʂ

  45. ͜Ε͚֮ͩ͑ͯԼ͍͞ʂ Chrome/Node͸ࠓޙ΋ͬͱ ଎͘ͳΔʂ Optimize.js ࢖͏ͱ΋ͬͱ ΋ͬͱ଎͘ͳΔ(͔΋)ʂ

  46. Node Collaborators Summit

  47. None
  48. Node.js ͷίϥϘϨʔλ͕Ұ ಉʹհͯ͠coreͷ࡞ۀΛߦͬ ͨΓɺٞ࿦͢Δ৔ॴ

  49. http2, promise, stream, etc

  50. ͜Μͳײ͡ͷ੒ՌɺͪͳΈʹIUUQ/PEFશવಈ͔ͳ͍ͷͰɺ ͪΌΜͱಈ͔ͤΔ΋ͷʹ͍͖ͯ͠·͢ ʆŋТŋ ʎ

  51. ·ͱΊ • jsconf.eu࠷ߴͰͨ͠ • ΈΜͳReactͱ͔Angularͱ͔ͦ͏͍͏࿩͸ͯ͠ͳ͍ • Ͳ͔ͬͪͱ͍͏ͱJSͱ͍͏ΩʔϫʔυͷԞʹ͋Δ௿ϨΠϠʔͳ ෦෼ͩͬͨΓɺ΢Σϒ͚ͩͰ͸ͳ͍ผͷ໰୊Λղܾ͍ͯͨ͠Γ • Node

    Collaborators Meetup΋࠷ߴͰͨ͠ • Node.js http2 ΍͍ͬͯͧ͘ʂʂʂʂʂ
  52. ࣍͸Node InteractiveͰ ൃද͢Δ༧ఆͰ͢ɻ

  53. ͋Γ͕ͱ͏͍͟͝·ͨ͠