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

The World of Inline Module

Avatar for moznion moznion
March 03, 2018

The World of Inline Module

YAPC::Okinawa 2018 Onnasonの資料です

Avatar for moznion

moznion

March 03, 2018
Tweet

More Decks by moznion

Other Decks in Technology

Transcript

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

    Programming Languages • ʮPerlͷؔ਺ΛଞͷݴޠͰॻ͍ͯ૊ΈࠐΜͰ࣮ߦ͢Δʯ • ͝ଘ஌ Ingy döt Net ޚେͷΞΠσΞ (2000೥)
  2. How does it work? (Inline::C) • PerlͷίϯύΠϧϑΣΠζͰίϯύΠϧ͍ͯ͠Δ • _Inline/ σΟϨΫτϦʹ੒Ռ෺͕Ͱ͖Δ

    • md5ͷϑΟϯΨʔϓϦϯτ͕෇༩͞ΕΔ • ίϯύΠϧͯ͠Ͱ͖ͨόΠφϦΛμΠφϛοΫϦϯΫ
  3. How does it work? (Inline::Python) • Python.hΛXSϨΠϠͰ૊ΈࠐΜͰ͍Δ • Python.hΛ࢖ͬͯpythonίʔυΛevalͯ͠result objectʹ͢Δ

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

    • > you may be able to remove a bottleneck in your Perl code by using another language
  5. 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ʹର͢Δݴٴͳ͠)
  6. Management Cost • ॲཧܥ͕2ͭ (͋Δ͍͸ͦΕҎ্) ʹͳΔίετ • ։ൃ؀ڥ੔උ͕͠ΜͲ͍ (όʔδϣϯϩοΫ౳) •

    ຊ൪؀ڥ੔උ΋͠ΜͲ͍ • όʔδϣϯϩοΫ • όʔδϣϯΞοϓ • Inline::X ͕࢖͏Ϟδϡʔϧͷόʔδϣϯ؅ཧ
  7. ॴײ • > Maybe the best reason is "Because you

    want to!". Diversity keeps the world interesting. TMTOWTDI! • ࢓ࣄͩͱͦ͏΋ݴͬͯ͸͓ΕΜ……
  8. Q?