Hi,

FWIW I ran this test on my AlphaStation 255/300 with VMS 7.3-2 and Perl 5.8.7

$ perl tmp.pl
mybuffer: 65535
REC #100 geschrieben
REC #200 geschrieben
REC #300 geschrieben
REC #400 geschrieben
REC #500 geschrieben
took 59 seconds writing 0x20.
REC #100 geschrieben
REC #200 geschrieben
REC #300 geschrieben
REC #400 geschrieben
REC #500 geschrieben
took 350 seconds writing 0x00.
$

Using MONITOR it was apparent that the extra time is CPU processing not I/O.
My guess: a routine is scanning the buffer for non-NUL before writing it.

The disparity was less using the HP Perl 5.8.6 build for OpenVMS IA64 V8.3:
took 38 seconds writing 0x20.
took 71 seconds writing 0x00.

Which makes me wonder if the issue is somewhere in the CRTL.

And on Perl 5.10.0, OpenVMS 8.3 the difference was 39 secs vs 40 secs, i.e.
the problem goes away, perhaps the CRTL issue (if any) is not invoked?

Just for grins I also ran it on my PowerMac 1.5GHz G4 with MacOS X 10.5.4
and Perl 5.8.8.  The run time was 1-2 seconds for both writes.
second.

Regards,

       Jeremy Begg

 +---------------------------------------------------------+
 |            VSM Software Services Pty. Ltd.              |
 |                 http://www.vsm.com.au/                  |
 |       "OpenVMS Systems Management & Programming"        |
 |---------------------------------------------------------|
 | P.O.Box 402, Walkerville, |  E-Mail:  [EMAIL PROTECTED] |
 | South Australia 5081      |   Phone:  +61 8 8221 5188   |
 |---------------------------|  Mobile:  0414 422 947      |
 |  A.C.N. 068 409 156       |     FAX:  +61 8 8221 7199   |
 +---------------------------------------------------------+


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

Reply via email to