diff options
author | David Mitchell <davem@iabyn.com> | 2011-02-23 23:12:04 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2011-02-23 23:24:53 +0000 |
commit | c00ff1c7cd54af0ffb12e9cddb484ce0943d6f0d (patch) | |
tree | 434437ccc5f43b8a4a4e4ca9afd096996802f8d5 /lib/locale.t | |
parent | 6f9cf5ec4be448b28bbdeecb00f087f3daf7a03c (diff) | |
download | perl-c00ff1c7cd54af0ffb12e9cddb484ce0943d6f0d.tar.gz |
lib/locale.t: big speedup
This fix reduces the time for this test script on my debugging build
from 45 seconds to 6 seconds.
Basically, the structure of the main loop for test 117 now looks like:
foreach my $x (keys %UPPER) {
push @f, $x if (... something bad about $x...)
}
foreach my $x (keys %lower) {
push @f, $x if (... something bad about $x...)
}
ok(!@f);
Whereas before it looked like:
foreach my $x (keys %UPPER) {
push @f, $x if (... something bad about $x...)
foreach my $x (keys %lower) {
push @f, $x if (... something bad about $x...)
}
}
ok(!@f);
i.e. the %lower tests were inadvertently repeated many times
Diffstat (limited to 'lib/locale.t')
-rw-r--r-- | lib/locale.t | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/locale.t b/lib/locale.t index 68a4d606cf..5398c34209 100644 --- a/lib/locale.t +++ b/lib/locale.t @@ -802,26 +802,26 @@ foreach $Locale (@Locale) { # With utf8 both will fail since the locale concept # of upper/lower does not work well in Unicode. push @f, $x unless $x =~ /$y/i == $y =~ /$x/i; + } - foreach my $x (keys %lower) { - my $y = uc $x; - next unless lc $y eq $x; - print "# lower $x uc $y ", - $x =~ /$y/i ? 1 : 0, " ", - $y =~ /$x/i ? 1 : 0, "\n" if 0; - if ($x =~ $re || $y =~ $re) { # See above. - print "# Regex characters in '$x' or '$y', skipping test 117 for locale '$Locale'\n"; - next; - } - # With utf8 both will fail since the locale concept - # of upper/lower does not work well in Unicode. - push @f, $x unless $x =~ /$y/i == $y =~ /$x/i; + foreach my $x (keys %lower) { + my $y = uc $x; + next unless lc $y eq $x; + print "# lower $x uc $y ", + $x =~ /$y/i ? 1 : 0, " ", + $y =~ /$x/i ? 1 : 0, "\n" if 0; + if ($x =~ $re || $y =~ $re) { # See above. + print "# Regex characters in '$x' or '$y', skipping test 117 for locale '$Locale'\n"; + next; } - tryneoalpha($Locale, 117, @f == 0); - if (@f) { - print "# failed 117 locale '$Locale' characters @f\n" - } - } + # With utf8 both will fail since the locale concept + # of upper/lower does not work well in Unicode. + push @f, $x unless $x =~ /$y/i == $y =~ /$x/i; + } + tryneoalpha($Locale, 117, @f == 0); + if (@f) { + print "# failed 117 locale '$Locale' characters @f\n" + } } } |