← Index
NYTProf Performance Profile   « line view »
For split.pl
  Run on Thu Apr 20 02:05:47 2023
Reported on Thu Apr 20 18:31:10 2023

Filename/home/hejohns/perl5/lib/perl5/Data/Printer/Filter/CODE.pm
StatementsExecuted 14 statements in 300µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1117µs8µsData::Printer::Filter::CODE::::BEGIN@2Data::Printer::Filter::CODE::BEGIN@2
1115µs5µsData::Printer::Filter::CODE::::BEGIN@5Data::Printer::Filter::CODE::BEGIN@5
1115µs133µsData::Printer::Filter::CODE::::BEGIN@7Data::Printer::Filter::CODE::BEGIN@7
1114µs14µsData::Printer::Filter::CODE::::BEGIN@3Data::Printer::Filter::CODE::BEGIN@3
1113µs12µsData::Printer::Filter::CODE::::BEGIN@4Data::Printer::Filter::CODE::BEGIN@4
1111µs1µsData::Printer::Filter::CODE::::BEGIN@6Data::Printer::Filter::CODE::BEGIN@6
111200ns200nsData::Printer::Filter::CODE::::__ANON__Data::Printer::Filter::CODE::__ANON__ (xsub)
0000s0sData::Printer::Filter::CODE::::_deparseData::Printer::Filter::CODE::_deparse
0000s0sData::Printer::Filter::CODE::::_subref_is_reachableData::Printer::Filter::CODE::_subref_is_reachable
0000s0sData::Printer::Filter::CODE::::parseData::Printer::Filter::CODE::parse
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Data::Printer::Filter::CODE;
2215µs210µs
# spent 8µs (7+1) within Data::Printer::Filter::CODE::BEGIN@2 which was called: # once (7µs+1µs) by Data::Printer::Object::BEGIN@60 at line 2
use strict;
# spent 8µs making 1 call to Data::Printer::Filter::CODE::BEGIN@2 # spent 1µs making 1 call to strict::import
3212µs225µs
# spent 14µs (4+11) within Data::Printer::Filter::CODE::BEGIN@3 which was called: # once (4µs+11µs) by Data::Printer::Object::BEGIN@60 at line 3
use warnings;
# spent 14µs making 1 call to Data::Printer::Filter::CODE::BEGIN@3 # spent 11µs making 1 call to warnings::import
4214µs221µs
# spent 12µs (3+9) within Data::Printer::Filter::CODE::BEGIN@4 which was called: # once (3µs+9µs) by Data::Printer::Object::BEGIN@60 at line 4
use Data::Printer::Filter;
# spent 12µs making 1 call to Data::Printer::Filter::CODE::BEGIN@4 # spent 9µs making 1 call to Data::Printer::Filter::import
5214µs26µs
# spent 5µs (5+200ns) within Data::Printer::Filter::CODE::BEGIN@5 which was called: # once (5µs+200ns) by Data::Printer::Object::BEGIN@60 at line 5
use Data::Printer::Common;
# spent 5µs making 1 call to Data::Printer::Filter::CODE::BEGIN@5 # spent 200ns making 1 call to Data::Printer::Filter::CODE::__ANON__
6212µs11µs
# spent 1µs within Data::Printer::Filter::CODE::BEGIN@6 which was called: # once (1µs+0s) by Data::Printer::Object::BEGIN@60 at line 6
use Scalar::Util ();
# spent 1µs making 1 call to Data::Printer::Filter::CODE::BEGIN@6
72230µs2262µs
# spent 133µs (5+129) within Data::Printer::Filter::CODE::BEGIN@7 which was called: # once (5µs+129µs) by Data::Printer::Object::BEGIN@60 at line 7
use Fcntl;
# spent 133µs making 1 call to Data::Printer::Filter::CODE::BEGIN@7 # spent 129µs making 1 call to Exporter::import
8
911µs114µsfilter 'CODE' => \&parse;
10
11
12sub parse {
13 my ($subref, $ddp) = @_;
14 my $string;
15 my $color = 'code';
16 if ($ddp->deparse) {
17 $string = _deparse($subref, $ddp);
18 if ($ddp->coderef_undefined && $string =~ /\A\s*sub\s*;\s*\z/) {
19 $string = $ddp->coderef_undefined;
20 $color = 'undef';
21 }
22 }
23 elsif ($ddp->coderef_undefined && !_subref_is_reachable($subref)) {
24 $string = $ddp->coderef_undefined;
25 $color = 'undef';
26 }
27 else {
28 $string = $ddp->coderef_stub;
29 }
30 return $ddp->maybe_colorize($string, $color);
31};
32
33#######################################
34### Private auxiliary helpers below ###
35#######################################
36
37sub _deparse {
38 my ($subref, $ddp) = @_;
39 require B::Deparse;
40
41 # FIXME: line below breaks encapsulation on Data::Printer::Object
42 my $i = $ddp->{indent} + $ddp->{_array_padding};
43
44 my $deparseopts = ["-sCi${i}v'Useless const omitted'"];
45
46 my $sub = 'sub ' . B::Deparse->new($deparseopts)->coderef2text($subref);
47 my $pad = $ddp->newline;
48 $sub =~ s/\n/$pad/gse;
49 return $sub;
50}
51
52sub _subref_is_reachable {
53 my ($subref) = @_;
54 require B;
55 my $cv = B::svref_2object($subref);
56 return !(B::class($cv->ROOT) eq 'NULL' && !${ $cv->const_sv });
57}
58
5912µs1;
 
# spent 200ns within Data::Printer::Filter::CODE::__ANON__ which was called: # once (200ns+0s) by Data::Printer::Filter::CODE::BEGIN@5 at line 5
sub Data::Printer::Filter::CODE::__ANON__; # xsub