Skip to content

Instantly share code, notes, and snippets.

View gfx's full-sized avatar

FUJI Goro gfx

View GitHub Profile
#!perl
# with "Class-MOP/topic/unified-method-generation-w-xs" and" Moose/topic/xs-accessor"
use strict;
use Benchmark qw(:all);
use Config; printf "Perl/%vd in $Config{archname}\n\n", $^V;
use warnings;
no warnings 'once';
my $cxsa_is_loaded = eval q{
package CXSA;
# a result of http://gist.github.com/171785
Perl/5.10.0 in i686-linux
Moose/0.89 (Class::MOP/0.92)
Mouse/0.27
Class::XSAccessor/1.03
MoosePlain: Inline
MooseXS: XS
GETTING for simple attributes
#!perl -w
use strict;
use PadWalker qw(var_name);
sub validate(\@@){
my $args = shift;
foreach my $var(@_){
print var_name(1, \$var), "\n";
}
# a result of http://gist.github.com/171785
Perl/5.10.1 in i686-linux
Moose/0.89 (Class::MOP/0.92)
Mouse/0.27
Class::XSAccessor/1.03
MoosePlain: Inline
MooseXS: XS
GETTING for simple attributes
# tweak/method_common
$ ./miniperl gfx/method_call.pl
Rate pp_method pp_method_named
pp_method 3185778/s -- -9%
pp_method_named 3495252/s 10% --
$ ./miniperl gfx/method_call.pl
Rate pp_method pp_method_named
pp_method 3329679/s -- -7%
pp_method_named 3563122/s 7% --
# blead
$ ./miniperl gfx/method_call.pl
Rate pp_method pp_method_named
pp_method 2752511/s -- -13%
pp_method_named 3163807/s 15% --
$ ./miniperl gfx/method_call.pl
Rate pp_method pp_method_named
pp_method 2733378/s -- -17%
pp_method_named 3300471/s 21% --
#!perl
use Test::LeakTrace qw(leaktrace);
for my $x (qw(Date::Manip)){
eval "use $x";
leaktrace {
eval {
$x->import();
};
} '-verbose';
}
#!perl -w
use strict;
use Test::More tests => 3;
{
package T;
use Tie::Hash();
use base qw(Tie::StdHash);
sub FETCH{
my($self, $key) = @_;
@gfx
gfx / gist:218491
Created October 26, 2009 07:53 — forked from tokuhirom/gist:218473
筑波の雨はだいぶおさまった模様
package A;
sub DESTROY{ warn "DESTROY!" }
sub f{
my $a = bless {}, 'A';
goto &g;
}
sub g{
warn "g!";