develooper Front page | perl.perl5.porters | Postings from February 2014

[perl #121259] Slow global pattern match on specific large utf8 input

Thread Previous
From:
Tony Cook via RT
Date:
February 20, 2014 22:36
Subject:
[perl #121259] Slow global pattern match on specific large utf8 input
Message ID:
rt-4.0.18-19375-1392935804-1647.121259-15-0@perl.org
On Sun Feb 16 22:30:14 2014, perl5-porters@perl.org wrote:
> I wrote:
> > Now, why is the buffer that small?  I thought we were allocating an
> > extra byte for the sake of copy-on-write.
> 
> The extra byte is not added if we happen to have a nice large power
> of two.  Since sv_gets is allocating the string here (the assignment
> is optimised away and the input is read straight into $input), we can
> simply add a byte there, since we know we do not need a power of two.
> 
> Please try the sprout/121259 branch.  It seems to work for me.  (I
> still need to write a real commit message and comment the code.)

This fixed the performance for me, from:

real    3m58.732s
user    3m56.659s
sys     0m0.796s

to:

real    0m0.590s
user    0m0.236s
sys     0m0.176s

Tony


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=121259

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About