← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Wed Dec 14 15:57:08 2022
Reported on Wed Dec 14 16:00:33 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Exporter/Progressive.pm
StatementsExecuted 85 statements in 825µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
22275µs141µsSub::Exporter::Progressive::::importSub::Exporter::Progressive::import
21160µs66µsSub::Exporter::Progressive::::sub_export_optionsSub::Exporter::Progressive::sub_export_options
11129µs32µsSub::Exporter::Progressive::::BEGIN@3Sub::Exporter::Progressive::BEGIN@3
11129µs38µsSub::Exporter::Progressive::::__ANON__[:47]Sub::Exporter::Progressive::__ANON__[:47]
84114µs14µsSub::Exporter::Progressive::::CORE:matchSub::Exporter::Progressive::CORE:match (opcode)
1117µs13µsSub::Exporter::Progressive::::BEGIN@20Sub::Exporter::Progressive::BEGIN@20
1115µs6µsSub::Exporter::Progressive::::BEGIN@26Sub::Exporter::Progressive::BEGIN@26
1115µs44µsSub::Exporter::Progressive::::BEGIN@4Sub::Exporter::Progressive::BEGIN@4
1114µs17µsSub::Exporter::Progressive::::BEGIN@21Sub::Exporter::Progressive::BEGIN@21
1111µs1µsSub::Exporter::Progressive::::CORE:substSub::Exporter::Progressive::CORE:subst (opcode)
0000s0sSub::Exporter::Progressive::::_croakSub::Exporter::Progressive::_croak
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Sub::Exporter::Progressive;
210s$Sub::Exporter::Progressive::VERSION = '0.001013';
3228µs235µs
# spent 32µs (29+3) within Sub::Exporter::Progressive::BEGIN@3 which was called: # once (29µs+3µs) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 3
use strict;
# spent 32µs making 1 call to Sub::Exporter::Progressive::BEGIN@3 # spent 3µs making 1 call to strict::import
4282µs283µs
# spent 44µs (5+39) within Sub::Exporter::Progressive::BEGIN@4 which was called: # once (5µs+39µs) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 4
use warnings;
# spent 44µs making 1 call to Sub::Exporter::Progressive::BEGIN@4 # spent 39µs making 1 call to warnings::import
5
6# ABSTRACT: Only use Sub::Exporter if you need it
7
8sub _croak {
9 require Carp;
10 &Carp::croak;
11}
12
13
# spent 141µs (75+66) within Sub::Exporter::Progressive::import which was called 2 times, avg 70µs/call: # once (54µs+43µs) by B::Hooks::EndOfScope::BEGIN@20 at line 23 of B/Hooks/EndOfScope.pm # once (21µs+23µs) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 22 of B/Hooks/EndOfScope/XS.pm
sub import {
1421µs my ($self, @args) = @_;
15
1621µs my $inner_target = caller;
1723µs266µs my $export_data = sub_export_options($inner_target, @args);
# spent 66µs making 2 calls to Sub::Exporter::Progressive::sub_export_options, avg 33µs/call
18
1920s my $full_exporter;
20224µs219µs
# spent 13µs (7+6) within Sub::Exporter::Progressive::BEGIN@20 which was called: # once (7µs+6µs) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 20
no strict 'refs';
# spent 13µs making 1 call to Sub::Exporter::Progressive::BEGIN@20 # spent 6µs making 1 call to strict::unimport
21245µs230µs
# spent 17µs (4+13) within Sub::Exporter::Progressive::BEGIN@21 which was called: # once (4µs+13µs) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 21
no warnings 'once';
# spent 17µs making 1 call to Sub::Exporter::Progressive::BEGIN@21 # spent 13µs making 1 call to warnings::unimport
22210µs @{"${inner_target}::EXPORT_OK"} = @{$export_data->{exports}};
2329µs @{"${inner_target}::EXPORT"} = @{$export_data->{defaults}};
2428µs %{"${inner_target}::EXPORT_TAGS"} = %{$export_data->{tags}};
25
# spent 38µs (29+9) within Sub::Exporter::Progressive::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Exporter/Progressive.pm:47] which was called: # once (29µs+9µs) by namespace::clean::BEGIN@11 at line 11 of namespace/clean.pm
*{"${inner_target}::import"} = sub {
262455µs27µs
# spent 6µs (5+1000ns) within Sub::Exporter::Progressive::BEGIN@26 which was called: # once (5µs+1000ns) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 26
use strict;
# spent 6µs making 1 call to Sub::Exporter::Progressive::BEGIN@26 # spent 1µs making 1 call to strict::import
2711µs my ($self, @args) = @_;
28
2913µs if ( grep {
30113µs17µs length ref $_
# spent 7µs making 1 call to Sub::Exporter::Progressive::CORE:match
31 or
32 $_ !~ / \A [:-]? \w+ \z /xm
33 } @args ) {
34 _croak 'your usage of Sub::Exporter::Progressive requires Sub::Exporter to be installed'
35 unless eval { require Sub::Exporter };
36 $full_exporter ||= Sub::Exporter::build_exporter($export_data->{original});
37
38 goto $full_exporter;
3914µs11µs } elsif ( defined( (my ($num) = grep { m/^\d/ } @args)[0] ) ) {
# spent 1µs making 1 call to Sub::Exporter::Progressive::CORE:match
40 _croak "cannot export symbols with a leading digit: '$num'";
41 } else {
4211µs require Exporter;
43112µs11µs s/ \A - /:/xm for @args;
# spent 1µs making 1 call to Sub::Exporter::Progressive::CORE:subst
4411µs @_ = ($self, @args);
4516µs170µs goto \&Exporter::import;
# spent 70µs making 1 call to Exporter::import
46 }
47218µs };
4829µs return;
49}
50
5111µsmy $too_complicated = <<'DEATH';
52You are using Sub::Exporter::Progressive, but the features your program uses from
53Sub::Exporter cannot be implemented without Sub::Exporter, so you might as well
54just use vanilla Sub::Exporter
55DEATH
56
57
# spent 66µs (60+6) within Sub::Exporter::Progressive::sub_export_options which was called 2 times, avg 33µs/call: # 2 times (60µs+6µs) by Sub::Exporter::Progressive::import at line 17, avg 33µs/call
sub sub_export_options {
5822µs my ($inner_target, $setup, $options) = @_;
59
6020s my @exports;
61 my @defaults;
62 my %tags;
63
6421µs if ( ($setup||'') eq '-setup') {
6524µs my %options = %$options;
66
67 OPTIONS:
6827µs for my $opt (keys %options) {
6943µs if ($opt eq 'exports') {
70
7122µs _croak $too_complicated if ref $options{exports} ne 'ARRAY';
7220s @exports = @{$options{exports}};
7321µs _croak $too_complicated if grep { length ref $_ } @exports;
74
75 } elsif ($opt eq 'groups') {
7622µs %tags = %{$options{groups}};
7720s for my $tagset (values %tags) {
78 _croak $too_complicated if grep {
7929µs22µs length ref $_
# spent 2µs making 2 calls to Sub::Exporter::Progressive::CORE:match, avg 1µs/call
80 or
81 $_ =~ / \A - (?! all \b ) /x
8223µs } @{$tagset};
83 }
8421µs @defaults = @{$tags{default} || [] };
85 } else {
86 _croak $too_complicated;
87 }
88 }
89619µs44µs @{$_} = map { / \A [:-] all \z /x ? @exports : $_ } @{$_} for \@defaults, values %tags;
# spent 4µs making 4 calls to Sub::Exporter::Progressive::CORE:match, avg 1µs/call
9022µs $tags{all} ||= [ @exports ];
9122µs my %exports = map { $_ => 1 } @exports;
9221µs my @errors = grep { not $exports{$_} } @defaults;
9322µs _croak join(', ', @errors) . " is not exported by the $inner_target module\n" if @errors;
94 }
95
96 return {
97226µs exports => \@exports,
98 defaults => \@defaults,
99 original => $options,
100 tags => \%tags,
101 };
102}
103
10413µs1;
105
106__END__
 
# spent 14µs within Sub::Exporter::Progressive::CORE:match which was called 8 times, avg 2µs/call: # 4 times (4µs+0s) by Sub::Exporter::Progressive::sub_export_options at line 89, avg 1µs/call # 2 times (2µs+0s) by Sub::Exporter::Progressive::sub_export_options at line 79, avg 1µs/call # once (7µs+0s) by Sub::Exporter::Progressive::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Exporter/Progressive.pm:47] at line 30 # once (1µs+0s) by Sub::Exporter::Progressive::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Exporter/Progressive.pm:47] at line 39
sub Sub::Exporter::Progressive::CORE:match; # opcode
# spent 1µs within Sub::Exporter::Progressive::CORE:subst which was called: # once (1µs+0s) by Sub::Exporter::Progressive::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Exporter/Progressive.pm:47] at line 43
sub Sub::Exporter::Progressive::CORE:subst; # opcode