More Related Content Similar to Perl6 meets JVM Similar to Perl6 meets JVM (20) More from Tokuhiro Matsuno More from Tokuhiro Matsuno (20) Perl6 meets JVM5. This is Rakudo Star, a useful,
usable Perl 6 distribution for
"early adopters".
曰く、
12. You can use java
libraries, instead of poor
Perl6 libraries.
24. • Start-up speed
• File access
• JSON processing
• HTTP client
• HTTP Server(Performance)
• Access to mysql
• use java libraries
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
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
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">
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;
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)
84. my $label = JLabel.new("Hello,
world");
$frame.getContentPane.add($labe
l);