Change 25389 by [EMAIL PROTECTED] on 2005/09/12 14:42:43
Integrate:
[ 24652]
Subject: [PATCH] Speed up lib/unicore/mktables by 45%
From: Andy Lester <[EMAIL PROTECTED]>
Date: Tue, 31 May 2005 12:39:00 -0500
Message-ID: <[EMAIL PROTECTED]>
[ 24656]
Subject: [PATCH] eliminate always running mktables
From: Robin Barker <[EMAIL PROTECTED]>
Date: Wed, 1 Jun 2005 09:55:16 +0100
Message-ID: <[EMAIL PROTECTED]>
[ 24659]
If we're building config_heavy.pl somewhere else, then we need to
require it, not something (or maybe nothing) in the correct place.
Affected files ...
... //depot/maint-5.8/perl/Makefile.SH#47 integrate
... //depot/maint-5.8/perl/configpm#16 integrate
... //depot/maint-5.8/perl/lib/unicore/mktables#13 integrate
Differences ...
==== //depot/maint-5.8/perl/Makefile.SH#47 (text) ====
Index: perl/Makefile.SH
--- perl/Makefile.SH#46~24695~ Fri Jun 3 02:57:50 2005
+++ perl/Makefile.SH Mon Sep 12 07:42:43 2005
@@ -758,8 +758,9 @@
# (If trying to create a new port and having problems with the configpm script,
# try 'make minitest' and/or commenting out the tests at the end of configpm.)
$(CONFIGPM): config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
- $(LDLIBPTH) ./miniperl -Ilib configpm --heavy=lib/Config_heavy.pl
configpm.tmp
+ $(LDLIBPTH) ./miniperl -Ilib configpm --heavy=heavy.tmp configpm.tmp
sh mv-if-diff configpm.tmp lib/Config.pm
+ sh mv-if-diff heavy.tmp lib/Config_heavy.pl
lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl$(EXE_EXT) minimod.pl
$(CONFIGPM)
$(LDLIBPTH) ./miniperl minimod.pl > minimod.tmp
==== //depot/maint-5.8/perl/configpm#16 (xtext) ====
Index: perl/configpm
--- perl/configpm#15~23664~ Tue Dec 21 10:03:02 2004
+++ perl/configpm Mon Sep 12 07:42:43 2005
@@ -777,6 +777,7 @@
# Now do some simple tests on the Config.pm file we have created
unshift(@INC,'lib');
require $Config_PM;
+require $Config_heavy;
import Config;
die "$0: $Config_PM not valid"
==== //depot/maint-5.8/perl/lib/unicore/mktables#13 (text) ====
Index: perl/lib/unicore/mktables
--- perl/lib/unicore/mktables#12~24322~ Mon Apr 25 06:25:15 2005
+++ perl/lib/unicore/mktables Mon Sep 12 07:42:43 2005
@@ -390,32 +390,15 @@
return $Table;
}
-##
-## Returns true if the Table has no code points
-##
-sub Table::IsEmpty
-{
- my $Table = shift; #self
- return not @$Table;
-}
-
-##
-## Returns true if the Table has code points
-##
-sub Table::NotEmpty
-{
- my $Table = shift; #self
- return @$Table;
-}
##
## Returns the maximum code point currently in the table.
##
sub Table::Max
{
- my $Table = shift; #self
- confess "oops" if $Table->IsEmpty; ## must have code points to have a max
- return $Table->[-1]->[RANGE_END];
+ my $last = $_[0]->[-1]; ## last code point
+ confess "oops" unless $last; ## must have code points to have a max
+ return $last->[RANGE_END];
}
##
@@ -434,6 +417,8 @@
## Given a new code point, make the last range of the Table extend to
## include the new (and all intervening) code points.
##
+## Takes the time to make sure that the extension is valid.
+##
sub Table::Extend
{
my $Table = shift; #self
@@ -443,7 +428,21 @@
confess "oops ($codepoint <= $PrevMax)" if $codepoint <= $PrevMax;
- $Table->[-1]->[RANGE_END] = $codepoint;
+ $Table->ExtendNoCheck($codepoint);
+}
+
+
+##
+## Given a new code point, make the last range of the Table extend to
+## include the new (and all intervening) code points.
+##
+## Does NOT check that the extension is valid. Assumes that the caller
+## has already made this check.
+##
+sub Table::ExtendNoCheck
+{
+ ## Optmized adding: Assumes $Table and $codepoint as parms
+ $_[0]->[-1]->[RANGE_END] = $_[1];
}
##
@@ -481,13 +480,14 @@
## If we've already got a range working, and this code point is the next
## one in line, and if the name is the same, just extend the current range.
##
- if ($Table->NotEmpty
+ my $last = $Table->[-1];
+ if ($last
and
- $Table->Max == $codepoint - 1
+ $last->[RANGE_END] == $codepoint - 1
and
- $Table->[-1]->[RANGE_NAME] eq $name)
+ $last->[RANGE_NAME] eq $name)
{
- $Table->Extend($codepoint);
+ $Table->ExtendNoCheck($codepoint);
}
else
{
@@ -585,7 +585,7 @@
if ($start > $New->Max) {
$New->AppendRange($start, $end);
} elsif ($end > $New->Max) {
- $New->Extend($end);
+ $New->ExtendNoCheck($end);
}
}
@@ -662,7 +662,7 @@
{
my $Table = shift; #self
- return 0x1234 if $Table->IsEmpty();
+ return 0x1234 if not @$Table;
for my $set (@$Table)
{
End of Patch.