← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:13 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/charnames.pm
StatementsExecuted 16 statements in 1.24ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1113.04ms4.46mscharnames::::BEGIN@6charnames::BEGIN@6
1111.06ms1.08mscharnames::::BEGIN@5charnames::BEGIN@5
11111µs23µscharnames::::BEGIN@2charnames::BEGIN@2
1117µs11µscharnames::::BEGIN@3charnames::BEGIN@3
1116µs42µscharnames::::BEGIN@9charnames::BEGIN@9
3314µs4µscharnames::::CORE:qrcharnames::CORE:qr (opcode)
1114µs4µscharnames::::BEGIN@8charnames::BEGIN@8
0000s0scharnames::::importcharnames::import
0000s0scharnames::::string_vianamecharnames::string_vianame
0000s0scharnames::::viacodecharnames::viacode
0000s0scharnames::::vianamecharnames::vianame
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package charnames;
2219µs234µs
# spent 23µs (11+12) within charnames::BEGIN@2 which was called: # once (11µs+12µs) by Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@16 at line 2
use strict;
# spent 23µs making 1 call to charnames::BEGIN@2 # spent 12µs making 1 call to strict::import
3225µs214µs
# spent 11µs (7+3) within charnames::BEGIN@3 which was called: # once (7µs+3µs) by Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@16 at line 3
use warnings;
# spent 11µs making 1 call to charnames::BEGIN@3 # spent 4µs making 1 call to warnings::import
41500nsour $VERSION = '1.36';
52813µs11.08ms
# spent 1.08ms (1.06+23µs) within charnames::BEGIN@5 which was called: # once (1.06ms+23µs) by Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@16 at line 5
use unicore::Name; # mktables-generated algorithmically-defined names
# spent 1.08ms making 1 call to charnames::BEGIN@5
6289µs14.46ms
# spent 4.46ms (3.04+1.42) within charnames::BEGIN@6 which was called: # once (3.04ms+1.42ms) by Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@16 at line 6
use _charnames (); # The submodule for this where most of the work gets done
# spent 4.46ms making 1 call to charnames::BEGIN@6
7
8218µs14µs
# spent 4µs within charnames::BEGIN@8 which was called: # once (4µs+0s) by Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@16 at line 8
use bytes (); # for $bytes::hint_bits
# spent 4µs making 1 call to charnames::BEGIN@8
92272µs278µs
# spent 42µs (6+36) within charnames::BEGIN@9 which was called: # once (6µs+36µs) by Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@16 at line 9
use re "/aa"; # Everything in here should be ASCII
# spent 42µs making 1 call to charnames::BEGIN@9 # spent 36µs making 1 call to re::import
10
11# Translate between Unicode character names and their code points.
12# This is a wrapper around the submodule C<_charnames>. This design allows
13# C<_charnames> to be autoloaded to enable use of \N{...}, but requires this
14# module to be explicitly requested for the functions API.
15
161700ns$Carp::Internal{ (__PACKAGE__) } = 1;
17
18sub import
19{
20 shift; ## ignore class name
21 _charnames->import(@_);
22}
23
24# Cache of already looked-up values. This is set to only contain
25# official values, and user aliases can't override them, so scoping is
26# not an issue.
271100nsmy %viacode;
28
29sub viacode {
30 return _charnames::viacode(@_);
31}
32
33sub vianame
34{
35 if (@_ != 1) {
36 _charnames::carp "charnames::vianame() expects one name argument";
37 return ()
38 }
39
40 # Looks up the character name and returns its ordinal if
41 # found, undef otherwise.
42
43 my $arg = shift;
44
45 if ($arg =~ /^U\+([0-9a-fA-F]+)$/) {
46
47 # khw claims that this is poor interface design. The function should
48 # return either a an ord or a chr for all inputs; not be bipolar. But
49 # can't change it because of backward compatibility. New code can use
50 # string_vianame() instead.
51 my $ord = CORE::hex $1;
52 return chr $ord if $ord <= 255 || ! ((caller 0)[8] & $bytes::hint_bits);
53 _charnames::carp _charnames::not_legal_use_bytes_msg($arg, chr $ord);
54 return;
55 }
56
57 # The first 1 arg means wants an ord returned; the second that we are in
58 # runtime, and this is the first level routine called from the user
59 return _charnames::lookup_name($arg, 1, 1);
60} # vianame
61
62sub string_vianame {
63
64 # Looks up the character name and returns its string representation if
65 # found, undef otherwise.
66
67 if (@_ != 1) {
68 _charnames::carp "charnames::string_vianame() expects one name argument";
69 return;
70 }
71
72 my $arg = shift;
73
74 if ($arg =~ /^U\+([0-9a-fA-F]+)$/) {
75
76 my $ord = CORE::hex $1;
77 return chr $ord if $ord <= 255 || ! ((caller 0)[8] & $bytes::hint_bits);
78
79 _charnames::carp _charnames::not_legal_use_bytes_msg($arg, chr $ord);
80 return;
81 }
82
83 # The 0 arg means wants a string returned; the 1 arg means that we are in
84 # runtime, and this is the first level routine called from the user
85 return _charnames::lookup_name($arg, 0, 1);
86} # string_vianame
87
8813µs1;
89__END__
 
# spent 4µs within charnames::CORE:qr which was called 3 times, avg 1µs/call: # once (2µs+0s) by charnames::BEGIN@5 at line 26 of unicore/Name.pm # once (1µs+0s) by charnames::BEGIN@5 at line 315 of unicore/Name.pm # once (1µs+0s) by charnames::BEGIN@5 at line 27 of unicore/Name.pm
sub charnames::CORE:qr; # opcode