Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Are beheaded strings known to be slow?

by NERDVANA (Priest)
on Oct 11, 2025 at 14:24 UTC ( [id://11166462]=note: print w/replies, xml ) Need Help??


in reply to Re: Are beheaded strings known to be slow?
in thread Are beheaded strings known to be slow?

That's unfortunate... I have code that is using regexes on File::Map buffers under the assumption it was an efficient way to scan through a file. Maybe there's room for one more optimization that checks the length of what needs copied vs. the length of the source scalar? In the example, each iteration only needs to put a single character in $&.
  • Comment on Re^2: Are beheaded strings known to be slow?

Replies are listed 'Best First'.
Re^3: Are beheaded strings known to be slow?
by ikegami (Patriarch) on Oct 11, 2025 at 14:49 UTC

    You're forgetting about $` and $'. Between $`, $' and $&, the entire string is covered.

      Also unfortunate...

      Maybe it would be neat if there was a new feature that turned those off for any match in the scope where it was disabled... to maybe be added to some future "use v5.46".

      Or, maybe Regexp refs should have methods, so the regex engine can be used without affecting *any* global variables.

      my $match= qr/(\d+)/->match($subject); say $match->captures->[0] if $match;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11166462]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2026-03-17 00:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.