← Index
NYTProf Performance Profile   « line view »
For /usr/local/libexec/sympa/task_manager-debug.pl
  Run on Tue Jun 1 22:32:51 2021
Reported on Tue Jun 1 22:35:07 2021

Filename/usr/local/lib/perl5/site_perl/Locale/Messages.pm
StatementsExecuted 246077 statements in 402ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
3466111364ms3.16sLocale::Messages::::gettextLocale::Messages::gettext
3466111132ms205msLocale::Messages::::textdomainLocale::Messages::textdomain
1150116.28ms119msLocale::Messages::::dgettextLocale::Messages::dgettext
0000s0sLocale::Messages::::BEGIN@119Locale::Messages::BEGIN@119
0000s0sLocale::Messages::::BEGIN@228Locale::Messages::BEGIN@228
0000s0sLocale::Messages::::BEGIN@23Locale::Messages::BEGIN@23
0000s0sLocale::Messages::::BEGIN@235Locale::Messages::BEGIN@235
0000s0sLocale::Messages::::BEGIN@242Locale::Messages::BEGIN@242
0000s0sLocale::Messages::::BEGIN@25Locale::Messages::BEGIN@25
0000s0sLocale::Messages::::BEGIN@253Locale::Messages::BEGIN@253
0000s0sLocale::Messages::::BEGIN@262Locale::Messages::BEGIN@262
0000s0sLocale::Messages::::BEGIN@271Locale::Messages::BEGIN@271
0000s0sLocale::Messages::::BEGIN@282Locale::Messages::BEGIN@282
0000s0sLocale::Messages::::BEGIN@291Locale::Messages::BEGIN@291
0000s0sLocale::Messages::::BEGIN@300Locale::Messages::BEGIN@300
0000s0sLocale::Messages::::BEGIN@311Locale::Messages::BEGIN@311
0000s0sLocale::Messages::::BEGIN@320Locale::Messages::BEGIN@320
0000s0sLocale::Messages::::BEGIN@329Locale::Messages::BEGIN@329
0000s0sLocale::Messages::::BEGIN@338Locale::Messages::BEGIN@338
0000s0sLocale::Messages::::BEGIN@347Locale::Messages::BEGIN@347
0000s0sLocale::Messages::::BEGIN@356Locale::Messages::BEGIN@356
0000s0sLocale::Messages::::BEGIN@363Locale::Messages::BEGIN@363
0000s0sLocale::Messages::::BEGIN@370Locale::Messages::BEGIN@370
0000s0sLocale::Messages::::BEGIN@377Locale::Messages::BEGIN@377
0000s0sLocale::Messages::::BEGIN@384Locale::Messages::BEGIN@384
0000s0sLocale::Messages::::BEGIN@391Locale::Messages::BEGIN@391
0000s0sLocale::Messages::::BEGIN@398Locale::Messages::BEGIN@398
0000s0sLocale::Messages::::BEGIN@405Locale::Messages::BEGIN@405
0000s0sLocale::Messages::::BEGIN@412Locale::Messages::BEGIN@412
0000s0sLocale::Messages::::BEGIN@419Locale::Messages::BEGIN@419
0000s0sLocale::Messages::::CORE:substLocale::Messages::CORE:subst (opcode)
0000s0sLocale::Messages::::LC_ALLLocale::Messages::LC_ALL
0000s0sLocale::Messages::::LC_COLLATELocale::Messages::LC_COLLATE
0000s0sLocale::Messages::::LC_CTYPELocale::Messages::LC_CTYPE
0000s0sLocale::Messages::::LC_MESSAGESLocale::Messages::LC_MESSAGES
0000s0sLocale::Messages::::LC_MONETARYLocale::Messages::LC_MONETARY
0000s0sLocale::Messages::::LC_NUMERICLocale::Messages::LC_NUMERIC
0000s0sLocale::Messages::::LC_TIMELocale::Messages::LC_TIME
0000s0sLocale::Messages::::bind_textdomain_codesetLocale::Messages::bind_textdomain_codeset
0000s0sLocale::Messages::::bind_textdomain_filterLocale::Messages::bind_textdomain_filter
0000s0sLocale::Messages::::bindtextdomainLocale::Messages::bindtextdomain
0000s0sLocale::Messages::::dcgettextLocale::Messages::dcgettext
0000s0sLocale::Messages::::dcngettextLocale::Messages::dcngettext
0000s0sLocale::Messages::::dcnpgettextLocale::Messages::dcnpgettext
0000s0sLocale::Messages::::dcpgettextLocale::Messages::dcpgettext
0000s0sLocale::Messages::::dngettextLocale::Messages::dngettext
0000s0sLocale::Messages::::dnpgettextLocale::Messages::dnpgettext
0000s0sLocale::Messages::::dpgettextLocale::Messages::dpgettext
0000s0sLocale::Messages::::ngettextLocale::Messages::ngettext
0000s0sLocale::Messages::::nl_putenvLocale::Messages::nl_putenv
0000s0sLocale::Messages::::npgettextLocale::Messages::npgettext
0000s0sLocale::Messages::::pgettextLocale::Messages::pgettext
0000s0sLocale::Messages::::select_packageLocale::Messages::select_package
0000s0sLocale::Messages::::setlocaleLocale::Messages::setlocale
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1#! /bin/false
2
3# vim: set autoindent shiftwidth=4 tabstop=4:
4
5# Copyright (C) 2002-2017 Guido Flohr <guido.flohr@cantanea.com>,
6# all rights reserved.
7
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 3 of the License, or
11# (at your option) any later version.
12
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21package Locale::Messages;
22
23use strict;
24
25use vars qw ($package @EXPORT_OK %EXPORT_TAGS @ISA $VERSION);
26
27$VERSION = '1.32';
28
29# Try to load the C version first.
30$package = 'gettext_xs';
31
32# Do not load from current working directory.
33local @INC = grep { $_ ne '.' } @INC;
34
35eval <<'EOF';
# spent 0s executing statements in string eval
36require Locale::gettext_xs;
37my $version = Locale::gettext_xs::__gettext_xs_version();
38die "Version: version mismatch ($VERSION vs. $version)" unless $version eq $VERSION;
39EOF
40my $no_xs = $@;
41
42# There are systems where setlocale() and the LC_ constants are not
43# defined at all, see https://rt.cpan.org/Ticket/Display.html?id=98109
44#
45# On such systems, we always fall back to gettext_dumb.
46if ($no_xs) {
47 eval {
48 require POSIX;
49 # void
50 POSIX::setlocale(POSIX::LC_ALL());
51 };
52 if ($@) {
53 $package = 'gettext_dumb';
54 require Locale::gettext_dumb;
55 } else {
56 $package = 'gettext_pp';
57 require Locale::gettext_pp;
58 }
59}
60
61require Exporter;
62@ISA = qw (Exporter);
63%EXPORT_TAGS = (locale_h => [ qw (gettext
64 dgettext
65 dcgettext
66 ngettext
67 dngettext
68 dcngettext
69 pgettext
70 dpgettext
71 dcpgettext
72 npgettext
73 dnpgettext
74 dcnpgettext
75 textdomain
76 bindtextdomain
77 bind_textdomain_codeset
78 )
79 ],
80 libintl_h => [ qw (LC_CTYPE
81 LC_NUMERIC
82 LC_TIME
83 LC_COLLATE
84 LC_MONETARY
85 LC_MESSAGES
86 LC_ALL)
87 ],
88 );
89
90@EXPORT_OK = qw (select_package
91 turn_utf_8_on
92 turn_utf_8_off
93 gettext
94 dgettext
95 dcgettext
96 ngettext
97 dngettext
98 dcngettext
99 pgettext
100 dpgettext
101 dcpgettext
102 npgettext
103 dnpgettext
104 dcnpgettext
105 textdomain
106 bindtextdomain
107 bind_textdomain_codeset
108 bind_textdomain_filter
109 nl_putenv
110 setlocale
111 LC_CTYPE
112 LC_NUMERIC
113 LC_TIME
114 LC_COLLATE
115 LC_MONETARY
116 LC_MESSAGES
117 LC_ALL);
118
119BEGIN {
120 my ($has_encode, $has_bytes);
121
122 if ($] >= 5.006) {
123 unless (defined $has_encode) {
124 eval "require Encode";
# spent 0s executing statements in string eval
125 $has_encode = !$@;
126 }
127
128 unless ($has_encode || defined $has_bytes) {
129 eval "use bytes";
130 $has_bytes = !$@;
131 }
132 }
133
134 # Turn the UTF-8 flag on or off unconditionally. The prototypes
135 # allow an optional second parameter, so that you can use the
136 # functions as callbacks to bind_textdomain_filter.
137 if ($has_encode) {
138 eval <<'EOF';
# spent 355ms executing statements in string eval
# includes 200ms spent executing 71622 calls to 2 subs defined therein.
139sub turn_utf_8_on($;$)
140{
141 Encode::_utf8_on ($_[0]);
142 return $_[0];
143}
144
145sub turn_utf_8_off($;$)
146{
147 Encode::_utf8_off ($_[0]);
148 return $_[0];
149}
150
151EOF
152 } elsif ($has_bytes) {
153 eval <<'EOF';
154sub turn_utf_8_on($;$)
155{
156 $_[0] = pack "U0C*", unpack "C*", $_[0];
157}
158
159sub turn_utf_8_off($;$)
160{
161 use bytes;
162 $_[0] = join "", split //, $_[0];
163}
164
165EOF
166 } else {
167 eval <<'EOF';
168sub turn_utf_8_on($;$)
169{
170 return $_[0];
171}
172
173sub turn_utf_8_off($;$)
174{
175 return $_[0];
176}
177
178EOF
179 }
180}
181
182# The textdomain could be undef. We avoid a warning by specifying
183# a filter for the undefined textdomain.
184my %filters = (undef => \&turn_utf_8_off);
185
186sub select_package {
187 my ($pkg, $compatibility) = @_;
188
189 # Compatibility quirk for a bug pre 1.17:
190 if (__PACKAGE__ eq $pkg && defined $compatibility) {
191 $pkg = $compatibility;
192 }
193
194 if ($no_xs && 'gettext_xs' eq $pkg) {
195 $pkg = 'gettext_pp';
196 }
197
198 if (defined $pkg && 'gettext_pp' eq $pkg) {
199 # This branch is not unnecessary. The next (elsif) branch does
200 # essentially the same but catches compilation errors.
201 require Locale::gettext_pp;
202 $package = 'gettext_pp';
203 } elsif (defined $pkg) {
204 my $filename = "Locale::$pkg";
205 $filename =~ s{::|\'}{/};
206 $filename .= '.pm';
207 eval { require $filename };
208 $package = $pkg unless $@;
209 } else {
210 eval "require Locale::gettext_xs";
211 $package = 'gettext_xs' unless $@;
212 }
213
214 return $package;
215}
216
217sub bind_textdomain_filter ($;$$) {
218 my ($textdomain, $coderef, $data) = @_;
219
220 $filters{$textdomain} = [ $coderef, $data ];
221
222 return 1;
223}
224
225
# spent 205ms (132+72.6) within Locale::Messages::textdomain which was called 34661 times, avg 6µs/call: # 34661 times (132ms+72.6ms) by Locale::Messages::gettext at line 247, avg 6µs/call
sub textdomain (;$) {
226346618.61ms my $function = "Locale::${package}::textdomain";
227
228 no strict 'refs';
22934661172ms3466172.6ms &$function;
# spent 72.6ms making 34661 calls to Locale::gettext_pp::textdomain, avg 2µs/call
230}
231
232sub bindtextdomain ($;$) {
233 my $function = "Locale::${package}::bindtextdomain";
234
235 no strict 'refs';
236 &$function;
237}
238
239sub bind_textdomain_codeset ($;$) {
240 my $function = "Locale::${package}::bind_textdomain_codeset";
241
242 no strict 'refs';
243 &$function;
244}
245
246
# spent 3.16s (364ms+2.80) within Locale::Messages::gettext which was called 34661 times, avg 91µs/call: # 34661 times (364ms+2.80s) by Sympa::Language::_resolve_gettext_locale at line 383 of /usr/local/libexec/sympa/Sympa/Language.pm, avg 91µs/call
sub gettext ($) {
2473466128.5ms34661205ms my $textdomain = textdomain;
# spent 205ms making 34661 calls to Locale::Messages::textdomain, avg 6µs/call
2483466110.3ms $filters{$textdomain} ||= [ \&turn_utf_8_off ];
249346619.30ms my $cb = $filters{$textdomain};
250
251346617.49ms my $function = "Locale::${package}::gettext";
252
253 no strict 'refs';
25434661159ms693222.59s $cb->[0] (&$function, $cb->[1]);
# spent 2.47s making 34661 calls to Locale::gettext_dumb::gettext, avg 71µs/call # spent 123ms making 34661 calls to Locale::Messages::turn_utf_8_off, avg 4µs/call
255}
256
257
# spent 119ms (6.28+113) within Locale::Messages::dgettext which was called 1150 times, avg 103µs/call: # 1150 times (6.28ms+113ms) by Sympa::Language::dgettext at line 593 of /usr/local/libexec/sympa/Sympa/Language.pm, avg 103µs/call
sub dgettext($$) {
2581150863µs my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];
259
2601150417µs my $function = "Locale::${package}::dgettext";
261
262 no strict 'refs';
26311505.51ms2300113ms $cb->[0] (&$function, $cb->[1]);
# spent 110ms making 1150 calls to Locale::gettext_dumb::dgettext, avg 95µs/call # spent 2.85ms making 1150 calls to Locale::Messages::turn_utf_8_off, avg 2µs/call
264}
265
266sub dcgettext($$$) {
267 my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];
268
269 my $function = "Locale::${package}::dcgettext";
270
271 no strict 'refs';
272 $cb->[0] (&$function, $cb->[1]);
273}
274
275sub ngettext($$$) {
276 my $textdomain = textdomain;
277 $filters{$textdomain} ||= [ \&turn_utf_8_off ];
278 my $cb = $filters{$textdomain};
279
280 my $function = "Locale::${package}::ngettext";
281
282 no strict 'refs';
283 $cb->[0] (&$function, $cb->[1]);
284}
285
286sub dngettext($$$$) {
287 my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];
288
289 my $function = "Locale::${package}::dngettext";
290
291 no strict 'refs';
292 $cb->[0] (&$function, $cb->[1]);
293}
294
295sub dcngettext($$$$$) {
296 my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];
297
298 my $function = "Locale::${package}::dcngettext";
299
300 no strict 'refs';
301 $cb->[0] (&$function, $cb->[1]);
302}
303
304sub pgettext($$) {
305 my $textdomain = textdomain;
306 $filters{$textdomain} ||= [ \&turn_utf_8_off ];
307 my $cb = $filters{$textdomain};
308
309 my $function = "Locale::${package}::pgettext";
310
311 no strict 'refs';
312 $cb->[0] (&$function, $cb->[1]);
313}
314
315sub dpgettext($$$) {
316 my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];
317
318 my $function = "Locale::${package}::dpgettext";
319
320 no strict 'refs';
321 $cb->[0] (&$function, $cb->[1]);
322}
323
324sub dcpgettext($$$$) {
325 my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];
326
327 my $function = "Locale::${package}::dcpgettext";
328
329 no strict 'refs';
330 $cb->[0] (&$function, $cb->[1]);
331}
332
333sub npgettext($$$$) {
334 my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];
335
336 my $function = "Locale::${package}::npgettext";
337
338 no strict 'refs';
339 $cb->[0] (&$function, $cb->[1]);
340}
341
342sub dnpgettext($$$$$) {
343 my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];
344
345 my $function = "Locale::${package}::dnpgettext";
346
347 no strict 'refs';
348 $cb->[0] (&$function, $cb->[1]);
349}
350
351sub dcnpgettext($$$$$$) {
352 my $cb = $filters{$_[0]} ||= [ \&turn_utf_8_off ];
353
354 my $function = "Locale::${package}::dcnpgettext";
355
356 no strict 'refs';
357 $cb->[0] (&$function, $cb->[1]);
358}
359
360sub setlocale($;$) {
361 my $function = "Locale::${package}::setlocale";
362
363 no strict 'refs';
364 &$function;
365}
366
367sub nl_putenv($) {
368 my $function = "Locale::${package}::nl_putenv";
369
370 no strict 'refs';
371 &$function;
372}
373
374sub LC_NUMERIC {
375 my $function = "Locale::${package}::LC_NUMERIC";
376
377 no strict 'refs';
378 &$function;
379}
380
381sub LC_CTYPE {
382 my $function = "Locale::${package}::LC_CTYPE";
383
384 no strict 'refs';
385 &$function;
386}
387
388sub LC_TIME {
389 my $function = "Locale::${package}::LC_TIME";
390
391 no strict 'refs';
392 &$function;
393}
394
395sub LC_COLLATE {
396 my $function = "Locale::${package}::LC_COLLATE";
397
398 no strict 'refs';
399 &$function;
400}
401
402sub LC_MONETARY {
403 my $function = "Locale::${package}::LC_MONETARY";
404
405 no strict 'refs';
406 &$function;
407}
408
409sub LC_MESSAGES {
410 my $function = "Locale::${package}::LC_MESSAGES";
411
412 no strict 'refs';
413 &$function;
414}
415
416sub LC_ALL {
417 my $function = "Locale::${package}::LC_ALL";
418
419 no strict 'refs';
420 &$function;
421}
422
4231;
424
425__END__