Save 37% off PRO during our Black Friday Sale! »

遅延評価と健康

95d12ef3ae39f388be5a43b4788cb70e?s=47 Susisu
October 16, 2016

 遅延評価と健康

遅延評価でパーサコンビネータを高速化した話
http://connpass.com/event/39553/

95d12ef3ae39f388be5a43b4788cb70e?s=128

Susisu

October 16, 2016
Tweet

Transcript

  1. ஗ Ԇ ධ Ձ ͱ ݈ ߁ 2 0 1

    6 - 1 0 - 1 6 O U C C LT ձ # 5 @susisu2413
  2. ஗ Ԇ ධ Ձ Ͱ ύ ʔ α ί ϯ

    Ϗω ʔ λ Λ ޮ ཰ Խ ͠ ͨ ࿩ Λ ͠ · ͢
  3. ύ ʔ α ί ϯ Ϗω ʔ λ ʁ

  4. ߏ จ ղ ੳ ͢ Δ ΍ ͭ h t

    t p s : / / e n . w i k i p e d i a . o rg / w i k i / P a r s e r _ c o m b i n a t o r
  5. ೖ ྗ Τ ϥ ʔ ஋ ࢒ Γ ύʔα ύʔαΛؔ਺Ͱදݱ

    ʢ࣮༻্͸ΦϒδΣΫτͰϥοϓʣ
  6. ೖ ྗ Τ ϥ ʔ ஋ ࢒ Γ ύʔα ύ

    ʔ α ύ ʔ α ύʔα ίϯϏωʔλ ύʔαίϯϏωʔλͰΑΓෳࡶͳύʔαΛߏங
  7. ༗ ໊ ͳ ͷ P a r s e c

    ( H a s k e l l ) h t t p s : / / g i t h u b . c o m / a s l a t t e r / p a r s e c P a r s i m m o n ( J a v a S c r i p t ) h t t p s : / / g i t h u b . c o m / j n e e n / p a r s i m m o n
  8. ࡞ ͬͯ Έ ͨ ʢ 2 ೥ લ ʣ

  9. J a v a S c r i p t

    Ͱ P a r s e c ؙ ύ Ϋ Ϧ h t t p s : / / g i t h u b . c o m / s u s i s u / L o q u a t
  10. ͱ ͯ ΋ ศ ར ࣗ ࡞ ε Ϋ Ϧ

    ϓ τ ݴ ޠ G r a s s ί ϯύ Π ϥ ︙
  11. ੑ ೳ ͸ ʁ

  12. ໿1000ߦͷ JSON × 1000ճ (Node.js v6.7.0) ଎ ౓ ൺ ֱ

    Parsimmon: 4.8 sec PEG.js: 8.47 sec Loquat: 72724ms ࣗ࡞: ? sec
  13. ໿1000ߦͷ JSON × 1000ճ ଎ ౓ ൺ ֱ Parsimmon: 4.8

    sec PEG.js: 8.47 sec ࣗ࡞: 72.7 sec
  14. None
  15. ͳ ͥ ஗ ͍ ʁ

  16. V 8 ͷ ϓ ϩ ϑ Ν Π ϥ Ͱ

    ௐ ΂ Δ node --prof parse.js node --prof-process isolate-0x*-v8.log https://github.com/v8/v8/wiki/Using%20V8’s %20internal%20profiler
  17. ஗ ͍ ΋ ͷ ͨ ͪ ύ ʔ α ͷ

    ݁ ߹ จ ࣈ ͷ ύ ʔε Τ ϥ ʔ ॲ ཧ
  18. ࠓ ೔ ͷ ϝ Π ϯ Τ ϥ ʔ ॲ

  19. Τ ϥ ʔ ॲ ཧ ߏ จ ղ ੳ ࣦ

    ഊ ࣌ ʹ ώ ϯ τ Λ ग़ ͢ ͨ Ί ϝ ο η ʔ δ ഑ ྻ ͷ ݁ ߹ ͳ Ͳ
  20. ࣦ ഊ ͠ ͨ ͱ ͖ ͷ Έ ඞ ཁ

  21. ࣦ ഊ ͢ Δ · Ͱ ܭ ࢉ ͠ ͳ

    ͍
  22. ஗ Ԇ ධ Ձ

  23. ܭ ࢉ Λ ஗ Ԇ ͞ ͤ Δ ʹ ͸

    ʁ let x = 1 + 2;
  24. Ϋ ϩ ʔ δ ϟ ʹ ͢ Ε ͹ ྑ

    ͍ let x = () => 1 + 2;
  25. ຖ ճ ؔ ਺ ݺ ͼ ग़ ͠ Ω ϟ

    ο γ ϡ ͞ Ε ͳ ͍ ࢖ ͍ ͮ Β ͍
  26. Φ ϒ δΣ Ϋ τ Ͱ ϥ ο ϓ

  27. ΠϯλʔϑΣʔε͕ڞ௨ͨ̎ͭ͠ͷΫϥεΛ࡞੒ ParseError LazyParseError ௨ৗ൛ ஗Ԇ൛

  28. σʔλΛՃ޻͢Δͱ͖͸஗Ԇ൛Ͱ ܭࢉΛ஗Ԇͤ͞Δ ParseError LazyParseError Ճ޻ʢ݁߹ͳͲʣ Ճ޻

  29. ௨ৗ൛Ͱ͸ getter ͸ͦͷ··஋Λฦ͢ ParseError LazyParseError ஋

  30. ஗Ԇ൛Ͱ͸ getter ͸ධՁ͔ͯ͠Β஋Λฦ͢ ParseError LazyParseError ஋ ධՁ ݁Ռ͸Ωϟογϡ

  31. ݁ Ռ

  32. ໿1000ߦͷ JSON × 1000ճ ଎ ౓ ൺ ֱ ݩ: 72.7

    sec վྑ൛: 28.4 sec ஗ԆධՁ͋Γ: ? sec
  33. ໿1000ߦͷ JSON × 1000ճ ଎ ౓ ൺ ֱ ஗ԆධՁ͋Γ: 11.2

    sec ݩ: 72.7 sec վྑ൛: 28.4 sec
  34. ໿1000ߦͷ JSON × 1000ճ ଎ ౓ ൺ ֱ Parsimmon: 4.8

    sec PEG.js: 8.47 sec վྑ൛ + ஗ԆධՁ: 11.2 sec
  35. · ͱ Ί

  36. ஗ Ԇ ධ Ձ ͸ ͍ ͍ ͧ ܭ ࢉ

    ͷ ޮ ཰ Խ ଞ ʹ ΋ ॥ ؀ ఆ ٛ ͳ Ͳ
  37. ܽ ఺ ΋ ͋ Δ ͷ Ͱ ஫ ҙ ࣌

    ؒ ɾ ۭ ؒ త ί ε τ ࢥ Θ ͵ ε λ ο Ϋ ͷ ফ අ
  38. ύ ʔ α ί ϯ Ϗω ʔ λ v 2

    ͝ ظ ଴ Լ ͞ ͍ h t t p s : / / g i t h u b . c o m / s u s i s u / l o q u a t - c o re