Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Is it File::Map issue, or another 'helpful' Perl regex optimization?

by dave_the_m (Prior)
on Mar 18, 2017 at 09:06 UTC ( #1185135=note: print w/replies, xml ) Need Help??


in reply to Is it File::Map issue, or another 'helpful' Perl regex optimization?

In modern perls, copy-on-write (COW) is used to make a "copy" of the string in the case of a successful match. This copy shares the same string buffer between two scalar values (but unshares them if either scalar value tries to modify its buffer). This avoids the old performance penalty that having $& etc anywhere in your script would impose upon all subsequent matches, while not crashing on something like eval '$&'.

However, the type of string created by File::Map isn't suitable for being COWed, so perl copies the whole string instead.

I'll add it to my list of "things to see if we can improve in COW".

Dave.

  • Comment on Re: Is it File::Map issue, or another 'helpful' Perl regex optimization?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1185135]
help
Chatterbox?
and dust plays in a shaft of sunlight...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2018-06-22 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (122 votes). Check out past polls.

    Notices?