perl-unicode

Re: [not-yet-a-PATCH] compress Encode better

2002-11-04 08:30:26

On Mon, Nov 04, 2002 at 08:11:04PM +0900, Dan Kogai wrote:
NC and porters,

   First of all, this is a great patch.  Not only does it optimize the 
resulting shlibs, it seems to consume less memory during compilation.

Thanks. I wasn't actually trying to reduce memory usage during compilation
(either running the perl script, or running the C compiler)

The only change that was explictly thinking about memory and CPU usage for
the perl script was this one:
-   # We have a single long line. Split it at convenient commas.
-   $definition =~ s/(.{74,77},)/$1\n/g;
-   print $fh "$definition };\n\n";
+  # We have a single long line. Split it at convenient commas.
+  print $fh $1, "\n" while $definition =~ /\G(.{74,77},)/gcs;
+  print $fh substr ($definition, pos $definition), " };\n";

and I was bad and didn't actually benchmark its effects.
[instead of doing things in memory, and constantly re-copying the remainder of
the string every time the s///g adds a newline, the revised version prints
the sections of string out (and lets the IO system worry about aggregating
sections into one string]

Thank you, NC.

It's not a problem. It allowed me to put of doing other stuff :-)
[such as actually writing the book review I am supposed to be doing for
http://london.pm.org/reviews/ ]

On Mon, Nov 04, 2002 at 01:42:58PM +0000, Nick Ing-Simmons wrote:
Dan Kogai <dankogai(_at_)dan(_dot_)co(_dot_)jp> writes:
On Monday, Nov 4, 2002, at 19:17 Asia/Tokyo, Nick Ing-Simmons wrote:
Someone could/should write a generic test that pushes all codepoints
supported by a .ucm file both ways through the generated encoder
and checks for correctness. This would be a pointless thing to do
as part of perl's "make test" as once the "compiler" works it works,
but would be useful for folk working on the compile process.

That is already in as t/rt.pl.  Since the test takes a long time (30 
seconds on my PowerBook G4 800MHz) it is not a part of standard 'make 
test' suite.  The NC Patch passes all that.

Excellent. 

Mr Burns couldn't have put it better. :-)

On Mon, Nov 04, 2002 at 08:19:57PM +0900, Dan Kogai wrote:
On Monday, Nov 4, 2002, at 20:11 Asia/Tokyo, Dan Kogai wrote:
oh wait!  Encode.xs remains unchanged so Encode::* may still work....

Confirmed.  The NC patch works w/ preexisting shlibs.

Good. It would have been worrying if it had not. The idea was not to
change any of the internal data structures visible to any code anywhere,
just to change how the U8 strings they point were arranged.

Nicholas Clark
-- 
z-code better than perl?        http://www.perl.org/advocacy/spoofathon/