The World of Inline Module

672ee2598bea695496f11022a9a9c4c8?s=47 moznion
March 03, 2018

The World of Inline Module

YAPC::Okinawa 2018 Onnasonの資料です

672ee2598bea695496f11022a9a9c4c8?s=128

moznion

March 03, 2018
Tweet

Transcript

  1. 2.
  2. 4.
  3. 5.

    Inline? • https://metacpan.org/pod/distribution/Inline/lib/Inline.pod • > Write Perl Subroutines in Other

    Programming Languages • ʮPerlͷؔ਺ΛଞͷݴޠͰॻ͍ͯ૊ΈࠐΜͰ࣮ߦ͢Δʯ • ͝ଘ஌ Ingy döt Net ޚେͷΞΠσΞ (2000೥)
  4. 11.
  5. 13.

    How does it work? (Inline::C) • PerlͷίϯύΠϧϑΣΠζͰίϯύΠϧ͍ͯ͠Δ • _Inline/ σΟϨΫτϦʹ੒Ռ෺͕Ͱ͖Δ

    • md5ͷϑΟϯΨʔϓϦϯτ͕෇༩͞ΕΔ • ίϯύΠϧͯ͠Ͱ͖ͨόΠφϦΛμΠφϛοΫϦϯΫ
  6. 15.

    How does it work? (Inline::Python) • Python.hΛXSϨΠϠͰ૊ΈࠐΜͰ͍Δ • Python.hΛ࢖ͬͯpythonίʔυΛevalͯ͠result objectʹ͢Δ

    • result objectΛperlίʔυʹม׵ • Python.hͰpythonίʔυ͔Β໊લۭؒ৘ใΛҾͬ͜ൈ͘ • Ҿͬ͜ൈ໊͍ͨલۭؒΛperlίʔυʹຒΊࠐΉ • Pythonͷݺͼग़͠෦෼Λϥοϓͯ͠perl͔Βݺͼग़͠Մೳʹ͢Δ • ͳͲ……
  7. 17.

    Why Inline? • > The most obvious reason is performance.

    • > you may be able to remove a bottleneck in your Perl code by using another language
  8. 18.

    Why Inline? • > There are already two major facilities

    for extending Perl with C. They are XS and SWIG. • > There is a big fat learning curve involved with setting up and using the XS • (SWIGʹର͢Δݴٴͳ͠)
  9. 23.
  10. 24.
  11. 27.

    Management Cost • ॲཧܥ͕2ͭ (͋Δ͍͸ͦΕҎ্) ʹͳΔίετ • ։ൃ؀ڥ੔උ͕͠ΜͲ͍ (όʔδϣϯϩοΫ౳) •

    ຊ൪؀ڥ੔උ΋͠ΜͲ͍ • όʔδϣϯϩοΫ • όʔδϣϯΞοϓ • Inline::X ͕࢖͏Ϟδϡʔϧͷόʔδϣϯ؅ཧ
  12. 28.
  13. 38.
  14. 42.

    ॴײ • > Maybe the best reason is "Because you

    want to!". Diversity keeps the world interesting. TMTOWTDI! • ࢓ࣄͩͱͦ͏΋ݴͬͯ͸͓ΕΜ……
  15. 43.
  16. 52.

    Q?