Profile of Encode/Encoding.pm

← Index
NYTProf Performance Profile «line view»
For t/bug-md-11.t
Run on Fri Mar 8 13:27:24 2024
Reported on Fri Mar 8 13:30:23 2024

Filename | /home/micha/.plenv/versions/5.38.2/lib/perl5/site_perl/5.38.2/x86_64-linux/Encode/Encoding.pm
Statements | Executed 18 statements in 353µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 10µs | 11µs | Encode::Encoding::::BEGIN@4Encode::Encoding::BEGIN@4
1 | 1 | 1 | 6µs | 7µs | Encode::Encoding::::BEGIN@12Encode::Encoding::BEGIN@12
1 | 1 | 1 | 6µs | 6µs | Encode::Encoding::::BEGIN@10Encode::Encoding::BEGIN@10
1 | 1 | 1 | 4µs | 20µs | Encode::Encoding::::BEGIN@5Encode::Encoding::BEGIN@5
1 | 1 | 1 | 4µs | 25µs | Encode::Encoding::::BEGIN@14Encode::Encoding::BEGIN@14
1 | 1 | 1 | 2µs | 2µs | Encode::Encoding::::BEGIN@11Encode::Encoding::BEGIN@11
1 | 1 | 1 | 300ns | 300ns | Encode::Encoding::::__ANON__Encode::Encoding::__ANON__ (xsub)
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::DESTROYEncode::Encoding::DESTROY
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::DefineEncode::Encoding::Define
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::decodeEncode::Encoding::decode
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::encodeEncode::Encoding::encode
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::fromUnicodeEncode::Encoding::fromUnicode
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::mime_nameEncode::Encoding::mime_name
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::nameEncode::Encoding::name
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::needs_linesEncode::Encoding::needs_lines
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::perlio_okEncode::Encoding::perlio_ok
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::renewEncode::Encoding::renew
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::renewedEncode::Encoding::renewed
0 | 0 | 0 | 0s | 0s | Encode::Encoding::::toUnicodeEncode::Encoding::toUnicode

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Encode::Encoding;
2 |  |  |  |  |
3 |  |  |  |  | # Base class for classes which implement encodings
4 | 2 | 22µs | 2 | 13µs | # spent 11µs (10+2) within Encode::Encoding::BEGIN@4 which was called: # once (10µs+2µs) by parent::import at line 4 use strict; # spent 11µs making 1 call to Encode::Encoding::BEGIN@4 # spent 2µs making 1 call to strict::import
5 | 2 | 57µs | 2 | 35µs | # spent 20µs (4+16) within Encode::Encoding::BEGIN@5 which was called: # once (4µs+16µs) by parent::import at line 5 use warnings; # spent 20µs making 1 call to Encode::Encoding::BEGIN@5 # spent 16µs making 1 call to warnings::import
6 | 3 | 10µs | 1 | 2µs | our $VERSION = do { my @r = ( q$Revision: 2.8 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; # spent 2µs making 1 call to CORE::match
7 |  |  |  |  |
8 | 1 | 400ns |  |  | our @CARP_NOT = qw(Encode Encode::Encoder);
9 |  |  |  |  |
10 | 2 | 12µs | 1 | 6µs | # spent 6µs within Encode::Encoding::BEGIN@10 which was called: # once (6µs+0s) by parent::import at line 10 use Carp (); # spent 6µs making 1 call to Encode::Encoding::BEGIN@10
11 | 2 | 13µs | 1 | 2µs | # spent 2µs within Encode::Encoding::BEGIN@11 which was called: # once (2µs+0s) by parent::import at line 11 use Encode (); # spent 2µs making 1 call to Encode::Encoding::BEGIN@11
12 | 2 | 22µs | 2 | 7µs | # spent 7µs (6+300ns) within Encode::Encoding::BEGIN@12 which was called: # once (6µs+300ns) by parent::import at line 12 use Encode::MIME::Name; # spent 7µs making 1 call to Encode::Encoding::BEGIN@12 # spent 300ns making 1 call to Encode::Encoding::__ANON__
13 |  |  |  |  |
14 | 2 | 212µs | 2 | 47µs | # spent 25µs (4+21) within Encode::Encoding::BEGIN@14 which was called: # once (4µs+21µs) by parent::import at line 14 use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG}; # spent 25µs making 1 call to Encode::Encoding::BEGIN@14 # spent 21µs making 1 call to constant::import
15 |  |  |  |  |
16 |  |  |  |  | sub Define {
17 |  |  |  |  | my $obj = shift;
18 |  |  |  |  | my $canonical = shift;
19 |  |  |  |  | $obj = bless { Name => $canonical }, $obj unless ref $obj;
20 |  |  |  |  |
21 |  |  |  |  | # warn "$canonical => $obj\n";
22 |  |  |  |  | Encode::define_encoding( $obj, $canonical, @_ );
23 |  |  |  |  | }
24 |  |  |  |  |
25 |  |  |  |  | sub name { return shift->{'Name'} }
26 |  |  |  |  |
27 |  |  |  |  | sub mime_name {
28 |  |  |  |  | return Encode::MIME::Name::get_mime_name(shift->name);
29 |  |  |  |  | }
30 |  |  |  |  |
31 |  |  |  |  | sub renew {
32 |  |  |  |  | my $self = shift;
33 |  |  |  |  | my $clone = bless {%$self} => ref($self);
34 |  |  |  |  | $clone->{renewed}++; # so the caller can see it
35 |  |  |  |  | DEBUG and warn $clone->{renewed};
36 |  |  |  |  | return $clone;
37 |  |  |  |  | }
38 |  |  |  |  |
39 |  |  |  |  | sub renewed { return $_[0]->{renewed} || 0 }
40 |  |  |  |  |
41 | 1 | 900ns |  |  | *new_sequence = \&renew;
42 |  |  |  |  |
43 |  |  |  |  | sub needs_lines { 0 }
44 |  |  |  |  |
45 |  |  |  |  | sub perlio_ok {
46 |  |  |  |  | return eval { require PerlIO::encoding } ? 1 : 0;
47 |  |  |  |  | }
48 |  |  |  |  |
49 |  |  |  |  | # (Temporary|legacy) methods
50 |  |  |  |  |
51 |  |  |  |  | sub toUnicode { shift->decode(@_) }
52 |  |  |  |  | sub fromUnicode { shift->encode(@_) }
53 |  |  |  |  |
54 |  |  |  |  | #
55 |  |  |  |  | # Needs to be overloaded or just croak
56 |  |  |  |  | #
57 |  |  |  |  |
58 |  |  |  |  | sub encode {
59 |  |  |  |  | my $obj = shift;
60 |  |  |  |  | my $class = ref($obj) ? ref($obj) : $obj;
61 |  |  |  |  | Carp::croak( $class . "->encode() not defined!" );
62 |  |  |  |  | }
63 |  |  |  |  |
64 |  |  |  |  | sub decode {
65 |  |  |  |  | my $obj = shift;
66 |  |  |  |  | my $class = ref($obj) ? ref($obj) : $obj;
67 |  |  |  |  | Carp::croak( $class . "->encode() not defined!" );
68 |  |  |  |  | }
69 |  |  |  |  |
70 |  |  |  |  | sub DESTROY { }
71 |  |  |  |  |
72 | 1 | 4µs |  |  | 1;
73 |  |  |  |  | __END__
|  |  |  |  | # spent 300ns within Encode::Encoding::__ANON__ which was called: # once (300ns+0s) by Encode::Encoding::BEGIN@12 at line 12 sub Encode::Encoding::__ANON__; # xsub