Skip Menu |

This queue is for tickets about the File-Slurp CPAN distribution.

Report information
The Basics
Id: 59598
Status: rejected
Priority: 0/
Queue: File-Slurp

People
Owner: Nobody in particular
Requestors: info1 [...] wolframhumann.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 9999.13
Fixed in: (no value)



Subject: read_file very slow in Strawberry when $& is used
As far as I can see, this only happens on win32 with strawberry perl (but not cygwin). Compare perl -MFile::Slurp -E"$t=read_file('file_of_20MB'); say length $t; $&" to perl -MFile::Slurp -E"$t=read_file('file_of_20MB'); say length $t" On my system the first line takes about 20s to finish, the second line takes less than 1s. No penalty for using $& seems to occur when binmode=>':raw' is used. This may be unavoidable and the general penalty for using $& is mentioned in perlre, but I wouldn't expect regex matters to influence File::Slurp so heavily. Minimum solution would be a warning in the pod.
this has to do with winblows and their cr/lf line endings. cygwin doesn't have that from perl's point of view and so it isn't affected. the $& effect is there because it uses regexes to handle conversion of the line endings to \n as perl wants for normal text files. the answer is DON'T use $&. i won't document this as that feature is well known to slow down regexes and shouldn't ever be used.