develooper Front page | perl.perl5.porters | Postings from August 2010

Re: Patch to make string-append on win32 100 times faster

Thread Previous | Thread Next
Wolfram Humann
August 24, 2010 10:19
Re: Patch to make string-append on win32 100 times faster
Message ID:
On 21.08.2010 13:46, demerphq wrote:
> On 21 August 2010 12:52, Wolfram Humann<>  wrote:
>> perl -MData::Dumper -E"sub mt{my $d=shift;$d>0?[mt($d-1),mt($d-1)]:int rand
>> 100}; say length Dumper mt 18"
>> 34576966
>> needs approx. 6 seconds to print and 8 seconds to finish on both of these.
> Interesting, how does that compare for you if you stick a
>    $Data::Dumper::Useqq=1;
> before the dump?

Some more results, wristwatch timed -> ignore minor differences:

strawberry:    27 seconds
with my patch: 29 seconds
usemymalloc:   10 seconds

With $Data::Dumper::Useqq=1 I had to reduce N to 19 to avoid 
out-of-memory. Strawberryperl unpatched only.

Without $Data::Dumper::Useqq=1: 10 seconds,  462 MB
With $Data::Dumper::Useqq=1: 28 seconds, 1100 MB

>> No noticeable difference. With a touch of horror I have to report that the
>> printed stringlengths are slightly non-deterministic from run to run...???
> :-)
> No worries there, the code does use rand() after all, so we expect to
> see slightly different results from run to run (or the srand
> initialization would be broken). Add a srand(1) or change the int rand
> 100 to a constant and it should produce repeatable results.

O.k. so no need to be worried about the code. But maybe I need to be 
worried about a mind that is obvously able to type "rand" one moment and 
complain about the code running non-deterministic about 5 minutes later ;-)

I'll be on vacation soon. Won't be able to respond to news in this 
thread quickly (maybe not at all) for the weeks to come.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About