SlideShare a Scribd company logo
Submit Search
Upload
Perl6 meets JVM
Report
Tokuhiro Matsuno
Software Engineer at LINE Corp
Follow
•
5 likes
•
5,064 views
1
of
89
Perl6 meets JVM
•
5 likes
•
5,064 views
Download Now
Download to read offline
Report
Engineering
YAPC::Asia 2015
Read more
Tokuhiro Matsuno
Software Engineer at LINE Corp
Follow
Recommended
Test::Kantan - Perl and Testing
Tokuhiro Matsuno
5.1K views
•
79 slides
Perl6 web-app
Tokuhiro Matsuno
2.3K views
•
22 slides
Server::Starter meets Java
Tokuhiro Matsuno
4.3K views
•
32 slides
Asynchronous I/O in Python 3
Feihong Hsu
40.3K views
•
44 slides
Paris Monitoring meetup #1 - Zabbix at BlaBlaCar
Jean Baptiste Favre
1.9K views
•
26 slides
Great Tools Heavily Used In Japan, You Don't Know.
Junichi Ishida
6K views
•
64 slides
More Related Content
What's hot
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
4.1K views
•
21 slides
Perl Dist::Surveyor 2011
Tim Bunce
2.7K views
•
24 slides
Graal in GraalVM - A New JIT Compiler
Koichi Sakata
2.7K views
•
71 slides
Nashorn
Everett Toews
1.7K views
•
32 slides
Fluentd in Co-Work
Makoto Haruyama
9K views
•
61 slides
Developing high-performance network servers in Lisp
Vladimir Sedach
4K views
•
29 slides
What's hot
(20)
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
•
4.1K views
Perl Dist::Surveyor 2011
Tim Bunce
•
2.7K views
Graal in GraalVM - A New JIT Compiler
Koichi Sakata
•
2.7K views
Nashorn
Everett Toews
•
1.7K views
Fluentd in Co-Work
Makoto Haruyama
•
9K views
Developing high-performance network servers in Lisp
Vladimir Sedach
•
4K views
The Parenscript Common Lisp to JavaScript compiler
Vladimir Sedach
•
3.7K views
PHP7 - The New Engine for old good train
Xinchen Hui
•
32.6K views
[Community Open Camp] 給 PHP 開發者的 VS Code 指南
Shengyou Fan
•
20.1K views
Large-scaled Deploy Over 100 Servers in 3 Minutes
Hiroshi SHIBATA
•
3.8K views
Shall we play a game?
Maciej Lasyk
•
519.9K views
The Integration of Laravel with Swoole
Albert Chen
•
3.5K views
Hack & Fix, Hands on ColdFusion Security Training
ColdFusionConference
•
1.1K views
zlm-cython
Vladimir Ulogov
•
431 views
CPAN Training
Pedro Figueiredo
•
2.5K views
ZLM-Cython Build you first module
Vladimir Ulogov
•
551 views
Modern PHP Ch7 Provisioning Guide 導讀
Chen Cheng-Wei
•
2.9K views
Ruby 2.4 Internals
Koichi Sasada
•
1.6K views
Middleware as Code with mruby
Hiroshi SHIBATA
•
5.2K views
JRuby: What's Different (RORO Melbourne October 2011)
Charles Nutter
•
610 views
Similar to Perl6 meets JVM
GOTO Night with Charles Nutter Slides
Alexandra Masterson
1.3K views
•
90 slides
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
goccy
7.7K views
•
40 slides
Functional Programming in Clojure
Troy Miles
623 views
•
37 slides
Beyond JVM - YOW Melbourne 2013
Charles Nutter
3.3K views
•
115 slides
plackdo, plack-like web interface on perl6
Nobuo Danjou
1K views
•
39 slides
Jruby synergy-of-ruby-and-java
Keith Bennett
1.1K views
•
21 slides
Similar to Perl6 meets JVM
(20)
GOTO Night with Charles Nutter Slides
Alexandra Masterson
•
1.3K views
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
goccy
•
7.7K views
Functional Programming in Clojure
Troy Miles
•
623 views
Beyond JVM - YOW Melbourne 2013
Charles Nutter
•
3.3K views
plackdo, plack-like web interface on perl6
Nobuo Danjou
•
1K views
Jruby synergy-of-ruby-and-java
Keith Bennett
•
1.1K views
Plack on SL4A in Yokohama.pm #8
Yoshiki Kurihara
•
2.5K views
Leaner microservices with Java 10
Arto Santala
•
558 views
Pugs: A Perl 6 Implementation
Audrey Tang
•
4.2K views
De Java 8 ate Java 14
Víctor Leonel Orozco López
•
1.3K views
Server Locality Using Razor and LLDP - PuppetConf 2014
Puppet
•
1.7K views
De Java 8 a Java 11 y 14
Víctor Leonel Orozco López
•
1.9K views
First Day With J Ruby
Praveen Kumar Sinha
•
896 views
HotSpotコトハジメ
Yasumasa Suenaga
•
7.3K views
DevOps in PHP environment
Evaldo Felipe
•
160 views
Racing with Droids
Peter Hlavaty
•
3.5K views
Практики применения JRuby
.toster
•
967 views
The Enterprise Strikes Back
Burke Libbey
•
1.2K views
Node.js und die Oracle-Datenbank
Carsten Czarski
•
2.1K views
Glass fish rubyconf-india-2010-Arun gupta
ThoughtWorks
•
943 views
More from Tokuhiro Matsuno
20190126 yapc tokyo keynote
Tokuhiro Matsuno
9.1K views
•
46 slides
最近のPerlバイナリマネージャー Perl 編
Tokuhiro Matsuno
1.5K views
•
23 slides
Plenv and perl build, and search.cpan.org
Tokuhiro Matsuno
1.3K views
•
10 slides
MyBatis を利用した web application 開発についてのご紹介
Tokuhiro Matsuno
12.9K views
•
39 slides
Yapc fukuoka crust
Tokuhiro Matsuno
2.5K views
•
24 slides
Perl6 と web 開発と
Tokuhiro Matsuno
910 views
•
38 slides
More from Tokuhiro Matsuno
(20)
20190126 yapc tokyo keynote
Tokuhiro Matsuno
•
9.1K views
最近のPerlバイナリマネージャー Perl 編
Tokuhiro Matsuno
•
1.5K views
Plenv and perl build, and search.cpan.org
Tokuhiro Matsuno
•
1.3K views
MyBatis を利用した web application 開発についてのご紹介
Tokuhiro Matsuno
•
12.9K views
Yapc fukuoka crust
Tokuhiro Matsuno
•
2.5K views
Perl6 と web 開発と
Tokuhiro Matsuno
•
910 views
Lineにおけるspring frameworkの活用
Tokuhiro Matsuno
•
33.7K views
Openjdk 入門してみた話
Tokuhiro Matsuno
•
3.2K views
promgen - prometheus managemnet tool / simpleclient_java hacks @ Prometheus c...
Tokuhiro Matsuno
•
21K views
Java web application testing
Tokuhiro Matsuno
•
7.7K views
Javaで1から10まで書いた話(sanitized)
Tokuhiro Matsuno
•
12.4K views
[jjug] Java と Benchmark
Tokuhiro Matsuno
•
4.4K views
Devel::NYTProf::Apache
Tokuhiro Matsuno
•
1.8K views
MySQL のチューニングについて考えてみた
Tokuhiro Matsuno
•
2.7K views
Archer
Tokuhiro Matsuno
•
3.7K views
MySQL::NameLocker
Tokuhiro Matsuno
•
1.5K views
Inside MF
Tokuhiro Matsuno
•
1.1K views
Web Application FLow
Tokuhiro Matsuno
•
1K views
madeye agents
Tokuhiro Matsuno
•
1.1K views
madeye classes
Tokuhiro Matsuno
•
843 views
Recently uploaded
SNMPx
Amatullahbutt
12 views
•
12 slides
Plumbing
Iwiss Tools Co.,Ltd
11 views
•
14 slides
Art of Writing Research article slide share.pptx
sureshc91
14 views
•
42 slides
What is Unit Testing
Sadaaki Emura
21 views
•
25 slides
802.11 Computer Networks
TusharChoudhary72015
9 views
•
33 slides
An approach of ontology and knowledge base for railway maintenance
IJECEIAES
11 views
•
14 slides
Recently uploaded
(20)
SNMPx
Amatullahbutt
•
12 views
Plumbing
Iwiss Tools Co.,Ltd
•
11 views
Art of Writing Research article slide share.pptx
sureshc91
•
14 views
What is Unit Testing
Sadaaki Emura
•
21 views
802.11 Computer Networks
TusharChoudhary72015
•
9 views
An approach of ontology and knowledge base for railway maintenance
IJECEIAES
•
11 views
LFA-NPG-Paper.pdf
harinsrikanth
•
40 views
IWISS Catalog 2022
Iwiss Tools Co.,Ltd
•
23 views
Electrical Crimping
Iwiss Tools Co.,Ltd
•
19 views
Investor Presentation
eser sevinç
•
15 views
Thermal aware task assignment for multicore processors using genetic algorithm
IJECEIAES
•
26 views
MSA Website Slideshow (16).pdf
msaucla
•
26 views
Design and analysis of a new undergraduate Computer Engineering degree – a me...
WaelBadawy6
•
50 views
Multi-objective distributed generation integration in radial distribution sy...
IJECEIAES
•
15 views
Object Oriented Programming with JAVA
Demian Antony D'Mello
•
58 views
2_DVD_ASIC_Design_FLow.pdf
Usha Mehta
•
10 views
NEW SUPPLIERS SUPPLIES (copie).pdf
georgesradjou
•
7 views
Digital Watermarking Of Audio Signals.pptx
AyushJaiswal781174
•
8 views
9_DVD_Dynamic_logic_circuits.pdf
Usha Mehta
•
19 views
Update 42 models(Diode/General ) in SPICE PARK(DEC2023)
Tsuyoshi Horigome
•
13 views
Perl6 meets JVM
1.
Perl6 + JVM tokuhirom YAPC::Asia
2016
2.
Self Introduction
3.
Amon2,Harriet, Localizer, Minilla, Test::Requires, etc.
4.
Perl6?
5.
This is Rakudo
Star, a useful, usable Perl 6 distribution for "early adopters". 曰く、
6.
useful??
7.
BTW,
8.
Products • nqp: Perl6
subset, to write Perl6 interpreter • rakudo: One of Perl6 implementation
9.
VM Support • Parrot:
VM for… • MoarVM: VM for Perl6 • JVM: VM for Java ← Today’s topic
10.
Why?
11.
Because, I’m using Java
for $DAYJOB
12.
You can use
java libraries, instead of poor Perl6 libraries.
13.
perl6-j is probably
useful for Java developers
14.
で?
15.
How do I
install Perl6?
16.
wget http://rakudo.org/ downloads/star/rakudo- star-2015.07.tar.gz
17.
tar xzvf rakudo- star-2015.07.tar.gz
18.
perl Configure.pl —backends=jvm —gen-nqp --prefix=$HOME/perl6
19.
• make • make
install
20.
Easy
21.
brew install rakudo-star —with-jvm
22.
Then…
23.
Evaluation point as
a Web developer
24.
• Start-up speed •
File access • JSON processing • HTTP client • HTTP Server(Performance) • Access to mysql • use java libraries
25.
Start-up speed
26.
time ./install/bin/perl6-j -e
'say "Hello, YAPC”’ Hello, YAPC ./install/bin/perl6-j -e 'say "Hello, YAPC”' 17.32s user 0.51s system 254% cpu 6.995 total
27.
Slow!
28.
Is JVM slow?
29.
No!
30.
> javac Hello.java >
time java Hello Hello java Hello 0.12s user 0.03s system 116% cpu 0.130 total
31.
time perl -E
'say "Hello, YAPC"' Hello, YAPC perl -E 'say "Hello, YAPC"' 0.04s user 0.04s system 83% cpu 0.094 total
32.
433 times slower
33.
time /usr/local/bin/perl6-m -e
'say "hello"' hello /usr/local/bin/perl6-m -e 'say "hello"' 0.31s user 0.04s system 97% cpu 0.360 total
34.
2. File Access
35.
say slurp("/etc/ passwd")
36.
It works.
37.
3. JSON
38.
use JSON::Tiny; (bundled)
39.
> use JSON::Tiny; >
from-json(‘[1,2,true]').perl [1, 2, Bool::True]
40.
to-json( {“a"=>5.16,"b"=>false,"c"=>[1..5]} )
41.
4. HTTP Client
42.
use LWP::Simple; (Bundled)
43.
> use LWP::Simple >
LWP::Simple.get("http:// 64p.org") <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o$ g/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
44.
useful!
45.
But there’s no
legacy encoding support.
46.
> LWP::Simple.get("http:// google.co.jp") Unknown encoding
'shift_jis'
47.
5. DB Access
48.
DB Access uses NativeCall
49.
NativeCall?
50.
FFI - Foreign
Function Interface
51.
Call C API
from Perl6
52.
JNA on JVM
53.
ちな Perl5 だと
54.
require DynaLoader; DynaLoader::dl_install_xsub( "myfork", DynaLoader::dl_find_symbol( DynaLoader::dl_load_file("libc.so"), 'fork' ), ); myfork();
55.
Joke…
56.
use FFI;
57.
そして Perl6 へ。。
58.
use DBDish;
59.
my $dbh = DBIish.connect('SQLite',
: database<thefile.sqlite3>);
60.
cp /usr/local/Cellar/sqlite/ 3.8.9/lib/libsqlite3.dylib ./
61.
Supported DB: PostgreSQL MySQL SQLite3
62.
use DBIish; my $dbh
= DBIish.connect('mysql', :host<127.0.0. 1>, :port(3306), :database<mysql>, :us er<root>, :password('')); my $sth = $dbh.prepare('SHOW TABLES'); $sth.execute(); my $arrayref = $sth.fetchall_arrayref(); $arrayref.perl.say;
63.
How do I
call JNI methods?
64.
sub mysql_affected_rows( OpaquePointer $mysql_client
) returns int32 is native('libmysqlclient') { ... }
65.
It’s easy!!!
66.
You can call
C APIs!
67.
6. HTTP Server
68.
HTTP::Easy::PSGI (bundled)
69.
use HTTP::Easy::PSGI; my $http
= HTTP::Easy::PSGI.new(:port(8080)); my $app = sub (%env) { my $name = %env<QUERY_STRING> || "World"; return [ 200, [ 'Content-Type' => 'text/plain' ], [ "Hello $name" ] ]; } $http.handle($app);
70.
with perl6-m • ab
-n 50 -c 1 http://127.0.0.1:8080/ • Requests per second: 5.95 [#/sec] (mean)
71.
with perl6-j • ab
-n 50 -c 1 http://127.0.0.1:8080/ • Requests per second: 10.60 [#/sec] (mean)
72.
10 threads +
perl6-j • ab -c 10 -n 1000 http://127.0.0.1:8080/ • Requests per second: 22.91 [#/sec] (mean)
73.
Single thread +
perl6-j • single thread • ab -c 10 -n 1000 http://127.0.0.1:8080/ • Requests per second: 17.84 [#/sec] (mean)
74.
ab -n 1000
-c 10 http://127.0.0.1:8080/
75.
Time per request: 550.895
[ms] (mean)
76.
(It doesn’t support concurrency)
77.
7. Call Java
methods
78.
use java::util::zip::CRC32:fro m< java>; my $crc =
CRC32.new();
79.
for 'Hello, Java'.encode('utf-8')
{ $crc.update($_) }
80.
$crc.getValue.say;
81.
it works.
82.
8. GUI
83.
my $frame = JFrame.new("Helloworl d"); $frame.setDefaultClose Operation(1);
84.
my $label =
JLabel.new("Hello, world"); $frame.getContentPane.add($labe l);
85.
$frame.pack(); $frame.setVisible(True)
86.
Demo
87.
use My::Own::Class:from< Java>:jar<hoge.jar>
88.
Conclusion
89.
There is some
issues. But practical than I thought