This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/locla/bin/perl | |
use strict; | |
use warnings; | |
use Benchmark qw(:all); | |
use DBI; | |
my $dbh = DBI->connect('dbi:mysql:hoge', 'test', 'test'); | |
cmpthese(50000, { | |
set => sub { | |
$dbh->do('set global innodb_flush_log_at_trx_commit=0'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/locla/bin/perl | |
use strict; | |
use warnings; | |
use Benchmark qw(:all); | |
use DBI; | |
my $dbh = DBI->connect('dbi:mysql:hoge', 'test', 'test'); | |
cmpthese(50000, { | |
set => sub { | |
$dbh->begin_work; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Test::More wrapper | |
{ | |
no strict 'refs'; ## no critic | |
for my $sub (qw/is is_deeply like isa_ok isnt unlike/) { | |
my $proto = prototype("Test::More::${sub}"); | |
my $code = set_prototype(sub { | |
push @_, $test_block_name if @_ == 2; | |
goto \&{"Test::More::${sub}"}; | |
} , $proto); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat irchttpd.pl | |
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use AnyEvent::IRC::Client; | |
use AnyEvent::JSONRPC::Lite::Server; | |
use AnyEvent; | |
my $channel = "#irctest"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub search { | |
container('db')->resultset_with_pager('MySQLFoundRows'); | |
} | |
sub search1 { | |
my $self = shift; | |
my $rs = $self->search; | |
# 検索条件なんかを追加する | |
} | |
sub search2 { | |
my $self = shift; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
use strict; | |
use warnings; | |
use Imager; | |
my $file = shift; | |
my @frames = Imager->read_multi( file => $file ); | |
my @new_frames; | |
for my $frame (@frames) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Plack::Request; | |
use Imager::QRCode qw(plot_qrcode); | |
use MIME::Base64; | |
sub { | |
my $env = shift; | |
my $r = Plack::Request->new($env); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> EXPLAIN SELECT job.id, job.arg, job.uniqkey, job.func_id, job.grabbed_until, job.retry_cnt, job.priority, func.name AS funcname FROM job INNER JOIN func ON job.func_id = func.id WHERE (func.name IN ('Idou::Worker::Test')) AND (job.grabbed_until <= '1275387047') AND (job.run_after <= '1275387047') ORDER BY job.priority DESC LIMIT 30; | |
+----+-------------+-------+-------+---------------+---------+---------+-------+-------+----------------+ | |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
+----+-------------+-------+-------+---------------+---------+---------+-------+-------+----------------+ | |
| 1 | SIMPLE | func | const | PRIMARY,name | name | 767 | const | 1 | Using filesort | | |
| 1 | SIMPLE | job | range | func_id | func_id | 4 | NULL | 99997 | Using where | | |
+----+-------------+-------+-------+---------------+---------+---------+-------+-------+----------------+ | |
2 rows in set (0.00 sec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> EXPLAIN SELECT job.id, job.arg, job.uniqkey, job.func_id, job.grabbed_until, job.retry_cnt, job.priority, func.name AS funcname FROM job INNER JOIN func ON job.func_id = func.id WHERE (func.name IN ('Idou::Worker::Test','Idou::Worker::Test1','Idou::Worker::Test2','Idou::Worker::Test3','Idou::Worker::Test4','Idou::Worker::Test5','Idou::Worker::Test6')) AND (job.grabbed_until <= '1275387047') AND (job.run_after <= '1275387047') ORDER BY job.priority DESC LIMIT 30; | |
+----+-------------+-------+-------+---------------+---------+---------+--------------+------+----------------------------------------------+ | |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
+----+-------------+-------+-------+---------------+---------+---------+--------------+------+----------------------------------------------+ | |
| 1 | SIMPLE | func | range | PRIMARY,name | name | 767 | NULL | 7 | Using where; Using temporary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for find_job | |
before: | |
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------+ | |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------+ | |
| 1 | SIMPLE | job | ALL | func_id | NULL | NULL | NULL | 1 | Using where; Using filesort | | |
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------+ | |
1 row in set (0.00 sec) |
OlderNewer