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