On Jul 28, 2008, at 5:56 AM, Jörg Begemann wrote:
The following little code
<snip>
needed about 15 seconds on my AlphaServer_800 with
OpenVMS V8.3 and perl v5.8.6 .
Changing the $zerobuffer to other characters than zero,
the running time of this program on my machine lasted only
3 seconds.
Thanks for the nice reproducer. I've run this a few times with what I
have easily available and here's what I've found. With 5.8.4 and also
with a snapshot of what will eventually be 5.8.9 once it's released,
it takes between 2 and 8 times longer to write all zeros than any
other character. In other words, I can confirm the same problem you
are seeing. With bleadperl (the development stream headed toward
5.12, but at this point pretty similar to 5.10.0), it takes a little
bit longer (maybe 5% to 8% longer), but very much in the same ballpark
to write zeros.
These tests were done on an XP1000 running OVMS v8.3. I have no idea
what makes the difference and I'm not sure when I'll have time to
track this down further. The good news is that the problem appears to
be fixed in the latest development version of Perl, and hopefully in
5.10.0 as well (can anyone confirm that?). It would be nice to fix it
for 5.8.x, but we would need a good diagnosis of what's actually
happening first.
My revision of the reproducer is below. It uses a larger buffer and
does a timed comparison.
$ CREATE tmp.pl
my $mybuffer = chr(32) x 65535;
print "mybuffer: ", length($mybuffer), "\n";
my $test = "test.dat";
open (OUTPUT, ">$test" ) || die "Fehler open";
my $t = time;
for ($rec=1; $rec<=500; $rec++) {
print OUTPUT $mybuffer;
print "REC #$rec geschrieben\n" if ( ! ($rec % 100) );
}
my $t2 = time;
print "took " . ($t2 - $t) . " seconds writing 0x20.\n";
my $mybuffer = chr(0) x 65535;
$t2 = time;
for ($rec=1; $rec<=500; $rec++) {
print OUTPUT $mybuffer;
print "REC #$rec geschrieben\n" if ( ! ($rec % 100) );
}
print "took " . (time - $t2) . " seconds writing 0x00.\n";
close (OUTPUT);
---END---
________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]
"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser