develooper Front page | perl.perl5.porters | Postings from January 2012

Re: whither study()?

Thread Previous | Thread Next
Nicholas Clark
January 31, 2012 08:13
Re: whither study()?
Message ID:
On Mon, Jan 30, 2012 at 09:45:02AM -0800, Father Chrysostomos wrote:

> I wouldn't object.  But Jeffrey Friedl mentions in Mastering Regular
> Expressions that he uses it to speed up multiple regexp matches (for
> markup validation) against 475K strings.

On Tue, Jan 31, 2012 at 11:02:15AM -0500, Andy Dougherty wrote:

> Yes, I realize that slurping in paragraphs or whole files runs much faster
> -- unless you run out of memory, in which case it won't run at all:-(.  In
> the interest of avoiding arbitrary limits, I usually use the default
> line-at-a-time style -- that way some critical job won't bomb the night
> before a presentation with "Out of memory!". 

> 	time ./perl `awk '{print $1}' MANIFEST`  > /dev/null
> Perl           Study?   Slurp?    user time (sec)
> __________________________________________________________
> perl5.14.0-RC1   No        No        46.8
> perl5.14.0-RC1   Yes       No        44.5
> __________________________________________________________
> perl5.14.0-RC1   No        Yes        3.23
> perl5.14.0-RC1   Yes       Yes        0.66

Curious. All results so far suggest that study helps when searching for
patterns in *really* large strings (ie whole file scale), but for anything
smaller it's neutral or a slow down.

Nicholas Clark

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