Filename | /usr/lib/perl/5.10/Encode/Alias.pm |
Statements | Executed 3667 statements in 6.70ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
544 | 1 | 1 | 3.41ms | 3.44ms | find_alias | Encode::Alias::
44 | 44 | 1 | 291µs | 291µs | define_alias | Encode::Alias::
1 | 1 | 1 | 271µs | 635µs | init_aliases | Encode::Alias::
46 | 42 | 1 | 70µs | 70µs | CORE:qr (opcode) | Encode::Alias::
1 | 1 | 1 | 25µs | 87µs | BEGIN@8 | Encode::Alias::
1 | 1 | 1 | 21µs | 28µs | BEGIN@2 | Encode::Alias::
3 | 2 | 1 | 18µs | 18µs | CORE:match (opcode) | Encode::Alias::
1 | 1 | 1 | 14µs | 35µs | BEGIN@4 | Encode::Alias::
1 | 1 | 1 | 10µs | 23µs | BEGIN@3 | Encode::Alias::
2 | 1 | 1 | 5µs | 5µs | CORE:regcomp (opcode) | Encode::Alias::
1 | 1 | 1 | 2µs | 2µs | undef_aliases | Encode::Alias::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Encode::Alias; | ||||
2 | 3 | 28µs | 2 | 35µs | # spent 28µs (21+7) within Encode::Alias::BEGIN@2 which was called:
# once (21µs+7µs) by Encode::BEGIN@48 at line 2 # spent 28µs making 1 call to Encode::Alias::BEGIN@2
# spent 7µs making 1 call to strict::import |
3 | 3 | 28µs | 2 | 36µs | # spent 23µs (10+13) within Encode::Alias::BEGIN@3 which was called:
# once (10µs+13µs) by Encode::BEGIN@48 at line 3 # spent 23µs making 1 call to Encode::Alias::BEGIN@3
# spent 13µs making 1 call to warnings::import |
4 | 3 | 100µs | 2 | 57µs | # spent 35µs (14+21) within Encode::Alias::BEGIN@4 which was called:
# once (14µs+21µs) by Encode::BEGIN@48 at line 4 # spent 35µs making 1 call to Encode::Alias::BEGIN@4
# spent 21µs making 1 call to warnings::unimport |
5 | 3 | 30µs | 1 | 6µs | our $VERSION = do { my @r = ( q$Revision: 2.12 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; # spent 6µs making 1 call to Encode::Alias::CORE:match |
6 | sub DEBUG () { 0 } | ||||
7 | |||||
8 | 3 | 1.65ms | 2 | 149µs | # spent 87µs (25+62) within Encode::Alias::BEGIN@8 which was called:
# once (25µs+62µs) by Encode::BEGIN@48 at line 8 # spent 87µs making 1 call to Encode::Alias::BEGIN@8
# spent 62µs making 1 call to base::import |
9 | |||||
10 | # Public, encouraged API is exported by default | ||||
11 | |||||
12 | 1 | 1µs | our @EXPORT = | ||
13 | qw ( | ||||
14 | define_alias | ||||
15 | find_alias | ||||
16 | ); | ||||
17 | |||||
18 | 1 | 300ns | our @Alias; # ordered matching list | ||
19 | 1 | 200ns | our %Alias; # cached known aliases | ||
20 | |||||
21 | # spent 3.44ms (3.41+36µs) within Encode::Alias::find_alias which was called 544 times, avg 6µs/call:
# 544 times (3.41ms+36µs) by Encode::getEncoding at line 109 of Encode.pm, avg 6µs/call | ||||
22 | 544 | 513µs | require Encode; | ||
23 | 544 | 403µs | my $class = shift; | ||
24 | 544 | 257µs | my $find = shift; | ||
25 | 544 | 334µs | unless ( exists $Alias{$find} ) { | ||
26 | 1 | 1µs | $Alias{$find} = undef; # Recursion guard | ||
27 | 1 | 3µs | for ( my $i = 0 ; $i < @Alias ; $i += 2 ) { | ||
28 | 2 | 2µs | my $alias = $Alias[$i]; | ||
29 | 2 | 2µs | my $val = $Alias[ $i + 1 ]; | ||
30 | 2 | 600ns | my $new; | ||
31 | 2 | 35µs | 4 | 16µs | if ( ref($alias) eq 'Regexp' && $find =~ $alias ) { # spent 11µs making 2 calls to Encode::Alias::CORE:match, avg 6µs/call
# spent 5µs making 2 calls to Encode::Alias::CORE:regcomp, avg 2µs/call |
32 | 1 | 200ns | DEBUG and warn "eval $val"; | ||
33 | 1 | 27µs | $new = eval $val; # spent 5µs executing statements in string eval | ||
34 | 1 | 300ns | DEBUG and $@ and warn "$val, $@"; | ||
35 | } | ||||
36 | elsif ( ref($alias) eq 'CODE' ) { | ||||
37 | DEBUG and warn "$alias", "->", "($find)"; | ||||
38 | $new = $alias->($find); | ||||
39 | } | ||||
40 | elsif ( lc($find) eq lc($alias) ) { | ||||
41 | $new = $val; | ||||
42 | } | ||||
43 | 2 | 1µs | if ( defined($new) ) { | ||
44 | 1 | 500ns | next if $new eq $find; # avoid (direct) recursion on bugs | ||
45 | 1 | 200ns | DEBUG and warn "$alias, $new"; | ||
46 | 1 | 4µs | 1 | 0s | my $enc = # spent 20µs making 1 call to Encode::find_encoding, recursion: max depth 1, sum of overlapping time 20µs |
47 | ( ref($new) ) ? $new : Encode::find_encoding($new); | ||||
48 | 1 | 700ns | if ($enc) { | ||
49 | 1 | 700ns | $Alias{$find} = $enc; | ||
50 | 1 | 3µs | last; | ||
51 | } | ||||
52 | } | ||||
53 | 1 | 400ns | } | ||
54 | |||||
55 | # case insensitive search when canonical is not in all lowercase | ||||
56 | # RT ticket #7835 | ||||
57 | 1 | 900ns | unless ( $Alias{$find} ) { | ||
58 | my $lcfind = lc($find); | ||||
59 | for my $name ( keys %Encode::Encoding, keys %Encode::ExtModule ) | ||||
60 | { | ||||
61 | $lcfind eq lc($name) or next; | ||||
62 | $Alias{$find} = Encode::find_encoding($name); | ||||
63 | DEBUG and warn "$find => $name"; | ||||
64 | } | ||||
65 | } | ||||
66 | } | ||||
67 | 544 | 110µs | if (DEBUG) { | ||
68 | my $name; | ||||
69 | if ( my $e = $Alias{$find} ) { | ||||
70 | $name = $e->name; | ||||
71 | } | ||||
72 | else { | ||||
73 | $name = ""; | ||||
74 | } | ||||
75 | warn "find_alias($class, $find)->name = $name"; | ||||
76 | } | ||||
77 | 544 | 2.51ms | return $Alias{$find}; | ||
78 | } | ||||
79 | |||||
80 | # spent 291µs within Encode::Alias::define_alias which was called 44 times, avg 7µs/call:
# once (41µs+0s) by Encode::Alias::init_aliases at line 211
# once (19µs+0s) by Encode::Alias::init_aliases at line 186
# once (11µs+0s) by Encode::Alias::init_aliases at line 140
# once (11µs+0s) by Encode::Alias::init_aliases at line 145
# once (9µs+0s) by Encode::Alias::init_aliases at line 135
# once (8µs+0s) by Encode::Alias::init_aliases at line 239
# once (6µs+0s) by Encode::Alias::init_aliases at line 243
# once (6µs+0s) by Encode::Alias::init_aliases at line 217
# once (6µs+0s) by Encode::Alias::init_aliases at line 139
# once (6µs+0s) by Encode::Alias::init_aliases at line 160
# once (6µs+0s) by Encode::Alias::init_aliases at line 138
# once (5µs+0s) by Encode::Alias::init_aliases at line 175
# once (5µs+0s) by Encode::Alias::init_aliases at line 242
# once (5µs+0s) by Encode::Alias::init_aliases at line 235
# once (5µs+0s) by Encode::Alias::init_aliases at line 153
# once (5µs+0s) by Encode::Alias::init_aliases at line 255
# once (5µs+0s) by Encode::Alias::init_aliases at line 246
# once (5µs+0s) by Encode::Alias::init_aliases at line 236
# once (5µs+0s) by Encode::Alias::init_aliases at line 154
# once (5µs+0s) by Encode::Alias::init_aliases at line 168
# once (5µs+0s) by Encode::Alias::init_aliases at line 230
# once (5µs+0s) by Encode::Alias::init_aliases at line 152
# once (5µs+0s) by Encode::Alias::init_aliases at line 195
# once (5µs+0s) by Encode::Alias::init_aliases at line 227
# once (5µs+0s) by Encode::Alias::init_aliases at line 222
# once (5µs+0s) by Encode::Alias::init_aliases at line 253
# once (5µs+0s) by Encode::Alias::init_aliases at line 209
# once (5µs+0s) by Encode::Alias::init_aliases at line 179
# once (5µs+0s) by Encode::Alias::init_aliases at line 252
# once (5µs+0s) by Encode::Alias::init_aliases at line 259
# once (5µs+0s) by Encode::Alias::init_aliases at line 223
# once (5µs+0s) by Encode::Alias::init_aliases at line 254
# once (5µs+0s) by Encode::Alias::init_aliases at line 234
# once (5µs+0s) by Encode::Alias::init_aliases at line 157
# once (5µs+0s) by Encode::Alias::init_aliases at line 200
# once (5µs+0s) by Encode::Alias::init_aliases at line 251
# once (5µs+0s) by Encode::Alias::init_aliases at line 163
# once (5µs+0s) by Encode::Alias::init_aliases at line 233
# once (5µs+0s) by Encode::Alias::init_aliases at line 262
# once (5µs+0s) by Encode::Alias::init_aliases at line 173
# once (5µs+0s) by Encode::Alias::init_aliases at line 247
# once (5µs+0s) by Encode::Alias::init_aliases at line 237
# once (5µs+0s) by Encode::Alias::init_aliases at line 248
# once (5µs+0s) by Encode::Alias::init_aliases at line 238 | ||||
81 | 44 | 140µs | while (@_) { | ||
82 | 53 | 35µs | my ( $alias, $name ) = splice( @_, 0, 2 ); | ||
83 | 53 | 43µs | unshift( @Alias, $alias => $name ); # newer one has precedence | ||
84 | 53 | 49µs | if ( ref($alias) ) { | ||
85 | |||||
86 | # clear %Alias cache to allow overrides | ||||
87 | 46 | 23µs | my @a = keys %Alias; | ||
88 | 46 | 40µs | for my $k (@a) { | ||
89 | if ( ref($alias) eq 'Regexp' && $k =~ $alias ) { | ||||
90 | DEBUG and warn "delete \$Alias\{$k\}"; | ||||
91 | delete $Alias{$k}; | ||||
92 | } | ||||
93 | elsif ( ref($alias) eq 'CODE' ) { | ||||
94 | DEBUG and warn "delete \$Alias\{$k\}"; | ||||
95 | delete $Alias{ $alias->($name) }; | ||||
96 | } | ||||
97 | } | ||||
98 | } | ||||
99 | else { | ||||
100 | 7 | 1µs | DEBUG and warn "delete \$Alias\{$alias\}"; | ||
101 | 7 | 3µs | delete $Alias{$alias}; | ||
102 | } | ||||
103 | } | ||||
104 | } | ||||
105 | |||||
106 | # Allow latin-1 style names as well | ||||
107 | # 0 1 2 3 4 5 6 7 8 9 10 | ||||
108 | 1 | 1µs | our @Latin2iso = ( 0, 1, 2, 3, 4, 9, 10, 13, 14, 15, 16 ); | ||
109 | |||||
110 | # Allow winlatin1 style names as well | ||||
111 | 1 | 7µs | our %Winlatin2cp = ( | ||
112 | 'latin1' => 1252, | ||||
113 | 'latin2' => 1250, | ||||
114 | 'cyrillic' => 1251, | ||||
115 | 'greek' => 1253, | ||||
116 | 'turkish' => 1254, | ||||
117 | 'hebrew' => 1255, | ||||
118 | 'arabic' => 1256, | ||||
119 | 'baltic' => 1257, | ||||
120 | 'vietnamese' => 1258, | ||||
121 | ); | ||||
122 | |||||
123 | 1 | 2µs | 1 | 635µs | init_aliases(); # spent 635µs making 1 call to Encode::Alias::init_aliases |
124 | |||||
125 | # spent 2µs within Encode::Alias::undef_aliases which was called:
# once (2µs+0s) by Encode::Alias::init_aliases at line 132 | ||||
126 | 1 | 400ns | @Alias = (); | ||
127 | 1 | 5µs | %Alias = (); | ||
128 | } | ||||
129 | |||||
130 | # spent 635µs (271+364) within Encode::Alias::init_aliases which was called:
# once (271µs+364µs) by Encode::BEGIN@48 at line 123 | ||||
131 | 1 | 700ns | require Encode; | ||
132 | 1 | 1µs | 1 | 2µs | undef_aliases(); # spent 2µs making 1 call to Encode::Alias::undef_aliases |
133 | |||||
134 | # Try all-lower-case version should all else fails | ||||
135 | 1 | 11µs | 2 | 13µs | define_alias( qr/^(.*)$/ => '"\L$1"' ); # spent 9µs making 1 call to Encode::Alias::define_alias
# spent 4µs making 1 call to Encode::Alias::CORE:qr |
136 | |||||
137 | # UTF/UCS stuff | ||||
138 | 1 | 6µs | 2 | 7µs | define_alias( qr/^(unicode-1-1-)?UTF-?7$/i => '"UTF-7"' ); # spent 6µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
139 | 1 | 5µs | 2 | 7µs | define_alias( qr/^UCS-?2-?LE$/i => '"UCS-2LE"' ); # spent 6µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
140 | 1 | 10µs | 4 | 15µs | define_alias( # spent 11µs making 1 call to Encode::Alias::define_alias
# spent 3µs making 3 calls to Encode::Alias::CORE:qr, avg 1µs/call |
141 | qr/^UCS-?2-?(BE)?$/i => '"UCS-2BE"', | ||||
142 | qr/^UCS-?4-?(BE|LE)?$/i => 'uc("UTF-32$1")', | ||||
143 | qr/^iso-10646-1$/i => '"UCS-2BE"' | ||||
144 | ); | ||||
145 | 1 | 10µs | 4 | 14µs | define_alias( # spent 11µs making 1 call to Encode::Alias::define_alias
# spent 3µs making 3 calls to Encode::Alias::CORE:qr, avg 1µs/call |
146 | qr/^UTF-?(16|32)-?BE$/i => '"UTF-$1BE"', | ||||
147 | qr/^UTF-?(16|32)-?LE$/i => '"UTF-$1LE"', | ||||
148 | qr/^UTF-?(16|32)$/i => '"UTF-$1"', | ||||
149 | ); | ||||
150 | |||||
151 | # ASCII | ||||
152 | 1 | 5µs | 2 | 6µs | define_alias( qr/^(?:US-?)ascii$/i => '"ascii"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
153 | 1 | 2µs | 1 | 5µs | define_alias( 'C' => 'ascii' ); # spent 5µs making 1 call to Encode::Alias::define_alias |
154 | 1 | 6µs | 2 | 7µs | define_alias( qr/\b(?:ISO[-_]?)?646(?:[-_]?US)?$/i => '"ascii"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
155 | |||||
156 | # Allow variants of iso-8859-1 etc. | ||||
157 | 1 | 5µs | 2 | 7µs | define_alias( qr/\biso[-_]?(\d+)[-_](\d+)$/i => '"iso-$1-$2"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
158 | |||||
159 | # At least HP-UX has these. | ||||
160 | 1 | 11µs | 2 | 7µs | define_alias( qr/\biso8859(\d+)$/i => '"iso-8859-$1"' ); # spent 6µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
161 | |||||
162 | # More HP stuff. | ||||
163 | 1 | 6µs | 2 | 6µs | define_alias( # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
164 | qr/\b(?:hp-)?(arabic|greek|hebrew|kana|roman|thai|turkish)8$/i => | ||||
165 | '"${1}8"' ); | ||||
166 | |||||
167 | # The Official name of ASCII. | ||||
168 | 1 | 5µs | 2 | 7µs | define_alias( qr/\bANSI[-_]?X3\.4[-_]?1968$/i => '"ascii"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
169 | |||||
170 | # This is a font issue, not an encoding issue. | ||||
171 | # (The currency symbol of the Latin 1 upper half | ||||
172 | # has been redefined as the euro symbol.) | ||||
173 | 1 | 5µs | 2 | 6µs | define_alias( qr/^(.+)\@euro$/i => '"$1"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
174 | |||||
175 | 1 | 5µs | 2 | 7µs | define_alias( qr/\b(?:iso[-_]?)?latin[-_]?(\d+)$/i => # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
176 | 'defined $Encode::Alias::Latin2iso[$1] ? "iso-8859-$Encode::Alias::Latin2iso[$1]" : undef' | ||||
177 | ); | ||||
178 | |||||
179 | 1 | 5µs | 2 | 6µs | define_alias( # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
180 | qr/\bwin(latin[12]|cyrillic|baltic|greek|turkish| | ||||
181 | hebrew|arabic|baltic|vietnamese)$/ix => | ||||
182 | '"cp" . $Encode::Alias::Winlatin2cp{lc($1)}' | ||||
183 | ); | ||||
184 | |||||
185 | # Common names for non-latin preferred MIME names | ||||
186 | 1 | 2µs | 1 | 19µs | define_alias( # spent 19µs making 1 call to Encode::Alias::define_alias |
187 | 'ascii' => 'US-ascii', | ||||
188 | 'cyrillic' => 'iso-8859-5', | ||||
189 | 'arabic' => 'iso-8859-6', | ||||
190 | 'greek' => 'iso-8859-7', | ||||
191 | 'hebrew' => 'iso-8859-8', | ||||
192 | 'thai' => 'iso-8859-11', | ||||
193 | ); | ||||
194 | # RT #20781 | ||||
195 | 1 | 6µs | 2 | 7µs | define_alias(qr/\btis-?620\b/i => '"iso-8859-11"'); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
196 | |||||
197 | # At least AIX has IBM-NNN (surprisingly...) instead of cpNNN. | ||||
198 | # And Microsoft has their own naming (again, surprisingly). | ||||
199 | # And windows-* is registered in IANA! | ||||
200 | 1 | 5µs | 2 | 6µs | define_alias( # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
201 | qr/\b(?:cp|ibm|ms|windows)[-_ ]?(\d{2,4})$/i => '"cp$1"' ); | ||||
202 | |||||
203 | # Sometimes seen with a leading zero. | ||||
204 | # define_alias( qr/\bcp037\b/i => '"cp37"'); | ||||
205 | |||||
206 | # Mac Mappings | ||||
207 | # predefined in *.ucm; unneeded | ||||
208 | # define_alias( qr/\bmacIcelandic$/i => '"macIceland"'); | ||||
209 | 1 | 5µs | 2 | 7µs | define_alias( qr/^mac_(.*)$/i => '"mac$1"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
210 | # http://rt.cpan.org/Ticket/Display.html?id=36326 | ||||
211 | 1 | 39µs | 2 | 42µs | define_alias( qr/^macintosh$/i => '"MacRoman"' ); # spent 41µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
212 | |||||
213 | # Ououououou. gone. They are differente! | ||||
214 | # define_alias( qr/\bmacRomanian$/i => '"macRumanian"'); | ||||
215 | |||||
216 | # Standardize on the dashed versions. | ||||
217 | 1 | 11µs | 2 | 8µs | define_alias( qr/\bkoi8[\s\-_]*([ru])$/i => '"koi8-$1"' ); # spent 6µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
218 | |||||
219 | 1 | 1µs | unless ($Encode::ON_EBCDIC) { | ||
220 | |||||
221 | # for Encode::CN | ||||
222 | 1 | 6µs | 2 | 6µs | define_alias( qr/\beuc.*cn$/i => '"euc-cn"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
223 | 1 | 5µs | 2 | 6µs | define_alias( qr/\bcn.*euc$/i => '"euc-cn"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
224 | |||||
225 | # define_alias( qr/\bGB[- ]?(\d+)$/i => '"euc-cn"' ) | ||||
226 | # CP936 doesn't have vendor-addon for GBK, so they're identical. | ||||
227 | 1 | 5µs | 2 | 6µs | define_alias( qr/^gbk$/i => '"cp936"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
228 | |||||
229 | # This fixes gb2312 vs. euc-cn confusion, practically | ||||
230 | 1 | 5µs | 2 | 6µs | define_alias( qr/\bGB[-_ ]?2312(?!-?raw)/i => '"euc-cn"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
231 | |||||
232 | # for Encode::JP | ||||
233 | 1 | 6µs | 2 | 6µs | define_alias( qr/\bjis$/i => '"7bit-jis"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
234 | 1 | 5µs | 2 | 6µs | define_alias( qr/\beuc.*jp$/i => '"euc-jp"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
235 | 1 | 5µs | 2 | 7µs | define_alias( qr/\bjp.*euc$/i => '"euc-jp"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
236 | 1 | 5µs | 2 | 7µs | define_alias( qr/\bujis$/i => '"euc-jp"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
237 | 1 | 5µs | 2 | 6µs | define_alias( qr/\bshift.*jis$/i => '"shiftjis"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
238 | 1 | 5µs | 2 | 6µs | define_alias( qr/\bsjis$/i => '"shiftjis"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
239 | 1 | 8µs | 2 | 12µs | define_alias( qr/\bwindows-31j$/i => '"cp932"' ); # spent 8µs making 1 call to Encode::Alias::define_alias
# spent 4µs making 1 call to Encode::Alias::CORE:qr |
240 | |||||
241 | # for Encode::KR | ||||
242 | 1 | 6µs | 2 | 7µs | define_alias( qr/\beuc.*kr$/i => '"euc-kr"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
243 | 1 | 5µs | 2 | 7µs | define_alias( qr/\bkr.*euc$/i => '"euc-kr"' ); # spent 6µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
244 | |||||
245 | # This fixes ksc5601 vs. euc-kr confusion, practically | ||||
246 | 1 | 8µs | 2 | 7µs | define_alias( qr/(?:x-)?uhc$/i => '"cp949"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
247 | 1 | 5µs | 2 | 6µs | define_alias( qr/(?:x-)?windows-949$/i => '"cp949"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
248 | 1 | 5µs | 2 | 6µs | define_alias( qr/\bks_c_5601-1987$/i => '"cp949"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
249 | |||||
250 | # for Encode::TW | ||||
251 | 1 | 5µs | 2 | 6µs | define_alias( qr/\bbig-?5$/i => '"big5-eten"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
252 | 1 | 5µs | 2 | 6µs | define_alias( qr/\bbig5-?et(?:en)?$/i => '"big5-eten"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
253 | 1 | 6µs | 2 | 7µs | define_alias( qr/\btca[-_]?big5$/i => '"big5-eten"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
254 | 1 | 5µs | 2 | 6µs | define_alias( qr/\bbig5-?hk(?:scs)?$/i => '"big5-hkscs"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 1 call to Encode::Alias::CORE:qr |
255 | 1 | 6µs | 2 | 7µs | define_alias( qr/\bhk(?:scs)?[-_]?big5$/i => '"big5-hkscs"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
256 | } | ||||
257 | |||||
258 | # utf8 is blessed :) | ||||
259 | 1 | 5µs | 2 | 6µs | define_alias( qr/\bUTF-8$/i => '"utf-8-strict"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
260 | |||||
261 | # At last, Map white space and _ to '-' | ||||
262 | 1 | 9µs | 2 | 6µs | define_alias( qr/^(\S+)[\s_]+(.*)$/i => '"$1-$2"' ); # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
263 | } | ||||
264 | |||||
265 | 1 | 13µs | 1; | ||
266 | __END__ | ||||
sub Encode::Alias::CORE:match; # opcode | |||||
# spent 70µs within Encode::Alias::CORE:qr which was called 46 times, avg 2µs/call:
# 3 times (3µs+0s) by Encode::Alias::init_aliases at line 145, avg 1µs/call
# 3 times (3µs+0s) by Encode::Alias::init_aliases at line 140, avg 1µs/call
# once (4µs+0s) by Encode::Alias::init_aliases at line 135
# once (4µs+0s) by Encode::Alias::init_aliases at line 239
# once (2µs+0s) by Encode::Alias::init_aliases at line 217
# once (2µs+0s) by Encode::Alias::init_aliases at line 157
# once (2µs+0s) by Encode::Alias::init_aliases at line 163
# once (2µs+0s) by Encode::Alias::init_aliases at line 254
# once (2µs+0s) by Encode::Alias::init_aliases at line 154
# once (2µs+0s) by Encode::Alias::init_aliases at line 195
# once (2µs+0s) by Encode::Alias::init_aliases at line 252
# once (2µs+0s) by Encode::Alias::init_aliases at line 168
# once (2µs+0s) by Encode::Alias::init_aliases at line 175
# once (2µs+0s) by Encode::Alias::init_aliases at line 251
# once (2µs+0s) by Encode::Alias::init_aliases at line 138
# once (2µs+0s) by Encode::Alias::init_aliases at line 253
# once (2µs+0s) by Encode::Alias::init_aliases at line 209
# once (2µs+0s) by Encode::Alias::init_aliases at line 242
# once (2µs+0s) by Encode::Alias::init_aliases at line 247
# once (1µs+0s) by Encode::Alias::init_aliases at line 237
# once (1µs+0s) by Encode::Alias::init_aliases at line 139
# once (1µs+0s) by Encode::Alias::init_aliases at line 227
# once (1µs+0s) by Encode::Alias::init_aliases at line 200
# once (1µs+0s) by Encode::Alias::init_aliases at line 179
# once (1µs+0s) by Encode::Alias::init_aliases at line 222
# once (1µs+0s) by Encode::Alias::init_aliases at line 246
# once (1µs+0s) by Encode::Alias::init_aliases at line 259
# once (1µs+0s) by Encode::Alias::init_aliases at line 243
# once (1µs+0s) by Encode::Alias::init_aliases at line 223
# once (1µs+0s) by Encode::Alias::init_aliases at line 234
# once (1µs+0s) by Encode::Alias::init_aliases at line 235
# once (1µs+0s) by Encode::Alias::init_aliases at line 238
# once (1µs+0s) by Encode::Alias::init_aliases at line 248
# once (1µs+0s) by Encode::Alias::init_aliases at line 160
# once (1µs+0s) by Encode::Alias::init_aliases at line 211
# once (1µs+0s) by Encode::Alias::init_aliases at line 173
# once (1µs+0s) by Encode::Alias::init_aliases at line 255
# once (1µs+0s) by Encode::Alias::init_aliases at line 233
# once (1µs+0s) by Encode::Alias::init_aliases at line 236
# once (1µs+0s) by Encode::Alias::init_aliases at line 230
# once (1µs+0s) by Encode::Alias::init_aliases at line 152
# once (1µs+0s) by Encode::Alias::init_aliases at line 262 | |||||
# spent 5µs within Encode::Alias::CORE:regcomp which was called 2 times, avg 2µs/call:
# 2 times (5µs+0s) by Encode::Alias::find_alias at line 31, avg 2µs/call |