Filename | /usr/lib/x86_64-linux-gnu/perl/5.20/Unicode/Normalize.pm |
Statements | Executed 23 statements in 728µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 43µs | 43µs | bootstrap (xsub) | Unicode::Normalize::
1 | 1 | 1 | 12µs | 12µs | BEGIN@12 | Unicode::Normalize::
1 | 1 | 1 | 9µs | 12µs | BEGIN@3 | Unicode::Normalize::
1 | 1 | 1 | 7µs | 20µs | BEGIN@17 | Unicode::Normalize::
1 | 1 | 1 | 6µs | 32µs | BEGIN@15 | Unicode::Normalize::
1 | 1 | 1 | 6µs | 10µs | BEGIN@14 | Unicode::Normalize::
1 | 1 | 1 | 6µs | 16µs | BEGIN@13 | Unicode::Normalize::
1 | 1 | 1 | 4µs | 4µs | CORE:unpack (opcode) | Unicode::Normalize::
0 | 0 | 0 | 0s | 0s | FCD | Unicode::Normalize::
0 | 0 | 0 | 0s | 0s | NFC_partial | Unicode::Normalize::
0 | 0 | 0 | 0s | 0s | NFD_partial | Unicode::Normalize::
0 | 0 | 0 | 0s | 0s | NFKC_partial | Unicode::Normalize::
0 | 0 | 0 | 0s | 0s | NFKD_partial | Unicode::Normalize::
0 | 0 | 0 | 0s | 0s | check | Unicode::Normalize::
0 | 0 | 0 | 0s | 0s | normalize | Unicode::Normalize::
0 | 0 | 0 | 0s | 0s | normalize_partial | Unicode::Normalize::
0 | 0 | 0 | 0s | 0s | pack_U | Unicode::Normalize::
0 | 0 | 0 | 0s | 0s | unpack_U | Unicode::Normalize::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package 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 | ||||
4 | 1 | 11µ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 | } | ||||
7 | 1 | 14µs | 1 | 4µ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 | } | ||||
10 | 1 | 18µs | 1 | 12µs | } # spent 12µs making 1 call to Unicode::Normalize::BEGIN@3 |
11 | |||||
12 | 2 | 44µs | 1 | 12µs | # spent 12µs within Unicode::Normalize::BEGIN@12 which was called:
# once (12µs+0s) by MARC::Charset::BEGIN@11 at line 12 # spent 12µs making 1 call to Unicode::Normalize::BEGIN@12 |
13 | 2 | 18µs | 2 | 25µ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 # spent 16µs making 1 call to Unicode::Normalize::BEGIN@13
# spent 10µs making 1 call to strict::import |
14 | 2 | 18µs | 2 | 14µ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 # spent 10µs making 1 call to Unicode::Normalize::BEGIN@14
# spent 4µs making 1 call to warnings::import |
15 | 2 | 22µs | 2 | 57µ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 # spent 32µs making 1 call to Unicode::Normalize::BEGIN@15
# spent 26µs making 1 call to Exporter::import |
16 | |||||
17 | 2 | 551µs | 2 | 34µ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 # spent 20µs making 1 call to Unicode::Normalize::BEGIN@17
# spent 14µs making 1 call to warnings::unimport |
18 | |||||
19 | 1 | 400ns | our $VERSION = '1.17'; | ||
20 | 1 | 100ns | our $PACKAGE = __PACKAGE__; | ||
21 | |||||
22 | 1 | 800ns | our @EXPORT = qw( NFC NFD NFKC NFKD ); | ||
23 | 1 | 2µs | our @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 | ); | ||||
32 | 1 | 5µs | our %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 | |||||
43 | sub pack_U { | ||||
44 | return pack('U*', @_); | ||||
45 | } | ||||
46 | |||||
47 | sub unpack_U { | ||||
48 | 1 | 1µs | return unpack('U*', shift(@_).pack('U*')); # spent 1µs making 1 call to main::CORE:pack | ||
49 | } | ||||
50 | |||||
51 | 1 | 400ns | require Exporter; | ||
52 | |||||
53 | ##### The above part is common to XS and PP ##### | ||||
54 | |||||
55 | 1 | 8µs | our @ISA = qw(Exporter DynaLoader); | ||
56 | 1 | 700ns | require DynaLoader; | ||
57 | 1 | 7µs | 1 | 760µs | bootstrap 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 | |||||
65 | sub FCD ($) { | ||||
66 | my $str = shift; | ||||
67 | return checkFCD($str) ? $str : NFD($str); | ||||
68 | } | ||||
69 | |||||
70 | 1 | 4µs | our %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 | |||||
78 | sub 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 | |||||
92 | sub 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 | |||||
102 | sub NFD_partial ($) { return normalize_partial('NFD', $_[0]) } | ||||
103 | sub NFC_partial ($) { return normalize_partial('NFC', $_[0]) } | ||||
104 | sub NFKD_partial($) { return normalize_partial('NFKD',$_[0]) } | ||||
105 | sub NFKC_partial($) { return normalize_partial('NFKC',$_[0]) } | ||||
106 | |||||
107 | ## | ||||
108 | ## check | ||||
109 | ## | ||||
110 | |||||
111 | 1 | 2µs | our %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 | |||||
119 | sub 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 | |||||
129 | 1 | 12µs | 1; | ||
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 | |||||
# spent 43µs within Unicode::Normalize::bootstrap which was called:
# once (43µs+0s) by DynaLoader::bootstrap at line 210 of DynaLoader.pm |