| Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/namespace/autoclean.pm |
| Statements | Executed 57 statements in 771µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 1.21ms | 1.57ms | namespace::autoclean::BEGIN@16 |
| 1 | 1 | 1 | 289µs | 2.27ms | namespace::autoclean::BEGIN@14 |
| 1 | 1 | 1 | 96µs | 1.57ms | namespace::autoclean::__ANON__[:57] |
| 1 | 1 | 1 | 13µs | 23µs | namespace::autoclean::import |
| 1 | 1 | 1 | 10µs | 21µs | Atom::BEGIN@1 |
| 1 | 1 | 1 | 10µs | 22µs | namespace::autoclean::BEGIN@13 |
| 1 | 1 | 1 | 7µs | 10µs | Atom::BEGIN@2.2 |
| 1 | 1 | 1 | 7µs | 26µs | namespace::autoclean::BEGIN@15 |
| 1 | 1 | 1 | 3µs | 3µs | namespace::autoclean::BEGIN@5 |
| 0 | 0 | 0 | 0s | 0s | namespace::autoclean::__ANON__[:25] |
| 0 | 0 | 0 | 0s | 0s | namespace::autoclean::__ANON__[:26] |
| 0 | 0 | 0 | 0s | 0s | namespace::autoclean::__ANON__[:27] |
| 0 | 0 | 0 | 0s | 0s | namespace::autoclean::__ANON__[:33] |
| 0 | 0 | 0 | 0s | 0s | namespace::autoclean::__ANON__[:51] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | 2 | 23µs | 2 | 31µs | # spent 21µs (10+11) within Atom::BEGIN@1 which was called:
# once (10µs+11µs) by Atom::BEGIN@3 at line 1 # spent 21µs making 1 call to Atom::BEGIN@1
# spent 11µs making 1 call to strict::import |
| 2 | 2 | 39µs | 2 | 14µs | # spent 10µs (7+3) within Atom::BEGIN@2.2 which was called:
# once (7µs+3µs) by Atom::BEGIN@3 at line 2 # spent 10µs making 1 call to Atom::BEGIN@2.2
# spent 3µs making 1 call to warnings::import |
| 3 | |||||
| 4 | package namespace::autoclean; | ||||
| 5 | # spent 3µs within namespace::autoclean::BEGIN@5 which was called:
# once (3µs+0s) by Atom::BEGIN@3 at line 7 | ||||
| 6 | 1 | 3µs | $namespace::autoclean::AUTHORITY = 'cpan:FLORA'; | ||
| 7 | 1 | 29µs | 1 | 3µs | } # spent 3µs making 1 call to namespace::autoclean::BEGIN@5 |
| 8 | { | ||||
| 9 | 2 | 500ns | $namespace::autoclean::VERSION = '0.13'; | ||
| 10 | } | ||||
| 11 | # ABSTRACT: Keep imports out of your namespace | ||||
| 12 | |||||
| 13 | 3 | 38µs | 2 | 34µs | # spent 22µs (10+12) within namespace::autoclean::BEGIN@13 which was called:
# once (10µs+12µs) by Atom::BEGIN@3 at line 13 # spent 22µs making 1 call to namespace::autoclean::BEGIN@13
# spent 12µs making 1 call to UNIVERSAL::VERSION |
| 14 | 2 | 99µs | 2 | 2.29ms | # spent 2.27ms (289µs+1.98) within namespace::autoclean::BEGIN@14 which was called:
# once (289µs+1.98ms) by Atom::BEGIN@3 at line 14 # spent 2.27ms making 1 call to namespace::autoclean::BEGIN@14
# spent 14µs making 1 call to Sub::Exporter::Progressive::__ANON__[Sub/Exporter/Progressive.pm:40] |
| 15 | 2 | 24µs | 2 | 45µs | # spent 26µs (7+19) within namespace::autoclean::BEGIN@15 which was called:
# once (7µs+19µs) by Atom::BEGIN@3 at line 15 # spent 26µs making 1 call to namespace::autoclean::BEGIN@15
# spent 19µs making 1 call to Exporter::import |
| 16 | 3 | 401µs | 3 | 1.72ms | # spent 1.57ms (1.21+352µs) within namespace::autoclean::BEGIN@16 which was called:
# once (1.21ms+352µs) by Atom::BEGIN@3 at line 16 # spent 1.57ms making 1 call to namespace::autoclean::BEGIN@16
# spent 149µs making 1 call to namespace::clean::import
# spent 8µs making 1 call to UNIVERSAL::VERSION |
| 17 | |||||
| 18 | |||||
| 19 | # spent 23µs (13+10) within namespace::autoclean::import which was called:
# once (13µs+10µs) by Atom::BEGIN@3 at line 3 of lib/HackaMol/Atom.pm | ||||
| 20 | 1 | 600ns | my ($class, %args) = @_; | ||
| 21 | |||||
| 22 | my $subcast = sub { | ||||
| 23 | my $i = shift; | ||||
| 24 | return $i if ref $i eq 'CODE'; | ||||
| 25 | return sub { $_ =~ $i } if ref $i eq 'Regexp'; | ||||
| 26 | return sub { $_ eq $i }; | ||||
| 27 | 1 | 2µs | }; | ||
| 28 | |||||
| 29 | my $runtest = sub { | ||||
| 30 | my ($code, $method_name) = @_; | ||||
| 31 | local $_ = $method_name; | ||||
| 32 | return $code->(); | ||||
| 33 | 1 | 1µs | }; | ||
| 34 | |||||
| 35 | 1 | 1µs | my $cleanee = exists $args{-cleanee} ? $args{-cleanee} : scalar caller; | ||
| 36 | |||||
| 37 | my @also = map { $subcast->($_) } ( | ||||
| 38 | exists $args{-also} | ||||
| 39 | 1 | 500ns | ? (ref $args{-also} eq 'ARRAY' ? @{ $args{-also} } : $args{-also}) | ||
| 40 | : () | ||||
| 41 | ); | ||||
| 42 | |||||
| 43 | # spent 1.57ms (96µs+1.47) within namespace::autoclean::__ANON__[/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/namespace/autoclean.pm:57] which was called:
# once (96µs+1.47ms) by B::Hooks::EndOfScope::XS::__ANON__[/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/B/Hooks/EndOfScope/XS.pm:26] at line 26 of B/Hooks/EndOfScope/XS.pm | ||||
| 44 | 1 | 2µs | 1 | 6µs | my $meta = Class::MOP::Class->initialize($cleanee); # spent 6µs making 1 call to Class::MOP::Class::initialize |
| 45 | 1 | 11µs | 1 | 1.01ms | my %methods = map { ($_ => 1) } $meta->get_method_list; # spent 1.01ms making 1 call to Class::MOP::Mixin::HasMethods::get_method_list |
| 46 | 1 | 4µs | 1 | 1µs | $methods{meta} = 1 if $meta->isa('Moose::Meta::Role') && Moose->VERSION < 0.90; # spent 1µs making 1 call to UNIVERSAL::isa |
| 47 | 1 | 300ns | my %extra = (); | ||
| 48 | |||||
| 49 | 1 | 4µs | for my $method (keys %methods) { | ||
| 50 | 13 | 3µs | next if exists $extra{$_}; | ||
| 51 | 13 | 49µs | 13 | 4µs | next unless first { $runtest->($_, $method) } @also; # spent 4µs making 13 calls to List::Util::first, avg 323ns/call |
| 52 | $extra{ $method } = 1; | ||||
| 53 | } | ||||
| 54 | |||||
| 55 | 1 | 9µs | 1 | 18µs | my @symbols = keys %{ $meta->get_all_package_symbols('CODE') }; # spent 18µs making 1 call to Class::MOP::Package::get_all_package_symbols |
| 56 | 1 | 8µs | 1 | 432µs | namespace::clean->clean_subroutines($cleanee, keys %extra, grep { !$methods{$_} } @symbols); # spent 432µs making 1 call to namespace::clean::clean_subroutines |
| 57 | 1 | 7µs | 1 | 10µs | }; # spent 10µs making 1 call to B::Hooks::EndOfScope::XS::on_scope_end |
| 58 | } | ||||
| 59 | |||||
| 60 | 1 | 2µs | 1; | ||
| 61 | |||||
| 62 | 1 | 8µs | 1 | 106µs | __END__ # spent 106µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:26] |