← Index
NYTProf Performance Profile   « line view »
For svc/members/upsert
  Run on Tue Jan 13 11:50:22 2015
Reported on Tue Jan 13 12:09:49 2015

Filename/usr/share/perl/5.20/charnames.pm
StatementsExecuted 18 statements in 2.78ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1113.62ms22.7mscharnames::::BEGIN@6charnames::BEGIN@6
1111.86ms1.88mscharnames::::BEGIN@5charnames::BEGIN@5
11179µs84µscharnames::::BEGIN@3charnames::BEGIN@3
11112µs22µscharnames::::BEGIN@2charnames::BEGIN@2
1118µs51µscharnames::::BEGIN@9charnames::BEGIN@9
1115µs144µscharnames::::importcharnames::import
1115µs5µscharnames::::BEGIN@8charnames::BEGIN@8
3314µs4µscharnames::::CORE:qrcharnames::CORE:qr (opcode)
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;
22107µs233µs
# spent 22µs (12+11) within charnames::BEGIN@2 which was called: # once (12µs+11µs) by MARC::Charset::BEGIN@13 at line 2
use strict;
# spent 22µs making 1 call to charnames::BEGIN@2 # spent 11µs making 1 call to strict::import
3234µs289µs
# spent 84µs (79+5) within charnames::BEGIN@3 which was called: # once (79µs+5µs) by MARC::Charset::BEGIN@13 at line 3
use warnings;
# spent 84µs making 1 call to charnames::BEGIN@3 # spent 5µs making 1 call to warnings::import
41600nsour $VERSION = '1.40';
521.64ms11.88ms
# spent 1.88ms (1.86+24µs) within charnames::BEGIN@5 which was called: # once (1.86ms+24µs) by MARC::Charset::BEGIN@13 at line 5
use unicore::Name; # mktables-generated algorithmically-defined names
# spent 1.88ms making 1 call to charnames::BEGIN@5
62693µs122.7ms
# spent 22.7ms (3.62+19.1) within charnames::BEGIN@6 which was called: # once (3.62ms+19.1ms) by MARC::Charset::BEGIN@13 at line 6
use _charnames (); # The submodule for this where most of the work gets done
# spent 22.7ms making 1 call to charnames::BEGIN@6
7
8222µs15µs
# spent 5µs within charnames::BEGIN@8 which was called: # once (5µs+0s) by MARC::Charset::BEGIN@13 at line 8
use bytes (); # for $bytes::hint_bits
# spent 5µs making 1 call to charnames::BEGIN@8
92274µs295µs
# spent 51µs (8+43) within charnames::BEGIN@9 which was called: # once (8µs+43µs) by MARC::Charset::BEGIN@13 at line 9
use re "/aa"; # Everything in here should be ASCII
# spent 51µs making 1 call to charnames::BEGIN@9 # spent 43µ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
161800ns$Carp::Internal{ (__PACKAGE__) } = 1;
17
18sub import
19
# spent 144µs (5+139) within charnames::import which was called: # once (5µs+139µs) by MARC::Charset::BEGIN@13 at line 13 of MARC/Charset.pm
{
201200ns shift; ## ignore class name
2114µs1139µs _charnames->import(@_);
# spent 139µs making 1 call to _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 27 of unicore/Name.pm # once (1µs+0s) by charnames::BEGIN@5 at line 316 of unicore/Name.pm # once (800ns+0s) by charnames::BEGIN@5 at line 28 of unicore/Name.pm
sub charnames::CORE:qr; # opcode