← 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/lib/x86_64-linux-gnu/perl/5.20/Unicode/Normalize.pm
StatementsExecuted 23 statements in 728µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11143µs43µsUnicode::Normalize::::bootstrapUnicode::Normalize::bootstrap (xsub)
11112µs12µsUnicode::Normalize::::BEGIN@12Unicode::Normalize::BEGIN@12
1119µs12µsUnicode::Normalize::::BEGIN@3Unicode::Normalize::BEGIN@3
1117µs20µsUnicode::Normalize::::BEGIN@17Unicode::Normalize::BEGIN@17
1116µs32µsUnicode::Normalize::::BEGIN@15Unicode::Normalize::BEGIN@15
1116µs10µsUnicode::Normalize::::BEGIN@14Unicode::Normalize::BEGIN@14
1116µs16µsUnicode::Normalize::::BEGIN@13Unicode::Normalize::BEGIN@13
1114µs4µsUnicode::Normalize::::CORE:unpackUnicode::Normalize::CORE:unpack (opcode)
0000s0sUnicode::Normalize::::FCDUnicode::Normalize::FCD
0000s0sUnicode::Normalize::::NFC_partialUnicode::Normalize::NFC_partial
0000s0sUnicode::Normalize::::NFD_partialUnicode::Normalize::NFD_partial
0000s0sUnicode::Normalize::::NFKC_partialUnicode::Normalize::NFKC_partial
0000s0sUnicode::Normalize::::NFKD_partialUnicode::Normalize::NFKD_partial
0000s0sUnicode::Normalize::::checkUnicode::Normalize::check
0000s0sUnicode::Normalize::::normalizeUnicode::Normalize::normalize
0000s0sUnicode::Normalize::::normalize_partialUnicode::Normalize::normalize_partial
0000s0sUnicode::Normalize::::pack_UUnicode::Normalize::pack_U
0000s0sUnicode::Normalize::::unpack_UUnicode::Normalize::unpack_U
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Unicode::Normalize;
2
3
# spent 12µs (9+4) within Unicode::Normalize::BEGIN@3 which was called: # once (9µs+4µs) by MARC::Charset::BEGIN@11 at line 10
BEGIN {
4111µs unless ('A' eq pack('U', 0x41)) {
# spent 11µs making 1 call to main::CORE:pack
5 die "Unicode::Normalize cannot stringify a Unicode code point\n";
6 }
7114µs14µs unless (0x41 == unpack('U', 'A')) {
# spent 4µs making 1 call to Unicode::Normalize::CORE:unpack
8 die "Unicode::Normalize cannot get Unicode code point\n";
9 }
10118µs112µs}
# spent 12µs making 1 call to Unicode::Normalize::BEGIN@3
11
12244µs112µs
# spent 12µs within Unicode::Normalize::BEGIN@12 which was called: # once (12µs+0s) by MARC::Charset::BEGIN@11 at line 12
use 5.006;
# spent 12µs making 1 call to Unicode::Normalize::BEGIN@12
13218µs225µs
# spent 16µs (6+10) within Unicode::Normalize::BEGIN@13 which was called: # once (6µs+10µs) by MARC::Charset::BEGIN@11 at line 13
use strict;
# spent 16µs making 1 call to Unicode::Normalize::BEGIN@13 # spent 10µs making 1 call to strict::import
14218µs214µs
# spent 10µs (6+4) within Unicode::Normalize::BEGIN@14 which was called: # once (6µs+4µs) by MARC::Charset::BEGIN@11 at line 14
use warnings;
# spent 10µs making 1 call to Unicode::Normalize::BEGIN@14 # spent 4µs making 1 call to warnings::import
15222µs257µs
# spent 32µs (6+26) within Unicode::Normalize::BEGIN@15 which was called: # once (6µs+26µs) by MARC::Charset::BEGIN@11 at line 15
use Carp;
# spent 32µs making 1 call to Unicode::Normalize::BEGIN@15 # spent 26µs making 1 call to Exporter::import
16
172551µs234µs
# spent 20µs (7+14) within Unicode::Normalize::BEGIN@17 which was called: # once (7µs+14µs) by MARC::Charset::BEGIN@11 at line 17
no warnings 'utf8';
# spent 20µs making 1 call to Unicode::Normalize::BEGIN@17 # spent 14µs making 1 call to warnings::unimport
18
191400nsour $VERSION = '1.17';
201100nsour $PACKAGE = __PACKAGE__;
21
221800nsour @EXPORT = qw( NFC NFD NFKC NFKD );
2312µsour @EXPORT_OK = qw(
24 normalize decompose reorder compose
25 checkNFD checkNFKD checkNFC checkNFKC check
26 getCanon getCompat getComposite getCombinClass
27 isExclusion isSingleton isNonStDecomp isComp2nd isComp_Ex
28 isNFD_NO isNFC_NO isNFC_MAYBE isNFKD_NO isNFKC_NO isNFKC_MAYBE
29 FCD checkFCD FCC checkFCC composeContiguous splitOnLastStarter
30 normalize_partial NFC_partial NFD_partial NFKC_partial NFKD_partial
31);
3215µsour %EXPORT_TAGS = (
33 all => [ @EXPORT, @EXPORT_OK ],
34 normalize => [ @EXPORT, qw/normalize decompose reorder compose/ ],
35 check => [ qw/checkNFD checkNFKD checkNFC checkNFKC check/ ],
36 fast => [ qw/FCD checkFCD FCC checkFCC composeContiguous/ ],
37);
38
39##
40## utilities for tests
41##
42
43sub pack_U {
44 return pack('U*', @_);
45}
46
47sub unpack_U {
4811µs return unpack('U*', shift(@_).pack('U*'));
# spent 1µs making 1 call to main::CORE:pack
49}
50
511400nsrequire Exporter;
52
53##### The above part is common to XS and PP #####
54
5518µsour @ISA = qw(Exporter DynaLoader);
561700nsrequire DynaLoader;
5717µs1760µsbootstrap Unicode::Normalize $VERSION;
# spent 760µs making 1 call to DynaLoader::bootstrap
58
59##### The below part is common to XS and PP #####
60
61##
62## normalize
63##
64
65sub FCD ($) {
66 my $str = shift;
67 return checkFCD($str) ? $str : NFD($str);
68}
69
7014µsour %formNorm = (
71 NFC => \&NFC, C => \&NFC,
72 NFD => \&NFD, D => \&NFD,
73 NFKC => \&NFKC, KC => \&NFKC,
74 NFKD => \&NFKD, KD => \&NFKD,
75 FCD => \&FCD, FCC => \&FCC,
76);
77
78sub normalize($$)
79{
80 my $form = shift;
81 my $str = shift;
82 if (exists $formNorm{$form}) {
83 return $formNorm{$form}->($str);
84 }
85 croak($PACKAGE."::normalize: invalid form name: $form");
86}
87
88##
89## partial
90##
91
92sub normalize_partial ($$) {
93 if (exists $formNorm{$_[0]}) {
94 my $n = normalize($_[0], $_[1]);
95 my($p, $u) = splitOnLastStarter($n);
96 $_[1] = $u;
97 return $p;
98 }
99 croak($PACKAGE."::normalize_partial: invalid form name: $_[0]");
100}
101
102sub NFD_partial ($) { return normalize_partial('NFD', $_[0]) }
103sub NFC_partial ($) { return normalize_partial('NFC', $_[0]) }
104sub NFKD_partial($) { return normalize_partial('NFKD',$_[0]) }
105sub NFKC_partial($) { return normalize_partial('NFKC',$_[0]) }
106
107##
108## check
109##
110
11112µsour %formCheck = (
112 NFC => \&checkNFC, C => \&checkNFC,
113 NFD => \&checkNFD, D => \&checkNFD,
114 NFKC => \&checkNFKC, KC => \&checkNFKC,
115 NFKD => \&checkNFKD, KD => \&checkNFKD,
116 FCD => \&checkFCD, FCC => \&checkFCC,
117);
118
119sub check($$)
120{
121 my $form = shift;
122 my $str = shift;
123 if (exists $formCheck{$form}) {
124 return $formCheck{$form}->($str);
125 }
126 croak($PACKAGE."::check: invalid form name: $form");
127}
128
129112µs1;
130__END__
 
# spent 4µs within Unicode::Normalize::CORE:unpack which was called: # once (4µs+0s) by Unicode::Normalize::BEGIN@3 at line 7
sub Unicode::Normalize::CORE:unpack; # opcode
# spent 43µs within Unicode::Normalize::bootstrap which was called: # once (43µs+0s) by DynaLoader::bootstrap at line 210 of DynaLoader.pm
sub Unicode::Normalize::bootstrap; # xsub