Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: An optimization of last resort: eliminate capturing from your regexps

by demerphq (Chancellor)
on Jul 11, 2006 at 08:56 UTC ( [id://560365]=note: print w/replies, xml ) Need Help??


in reply to Re: An optimization of last resort: eliminate capturing from your regexps
in thread An optimization of last resort: eliminate capturing from your regexps

Just so you know... $1 et all are basically ties that do something like

substr($something, $-[$digit], $+[$digit] - $-[$digit]);

Part of the reason for this is that internally perl doesnt populate $1 et all with copies when it runs the regex as when backtracking it could have to recopy the contents of these vars many many times. Wheras updating the appropriate offsets is cheap and constant time.

---
$world=~s/war/peace/g

  • Comment on Re^2: An optimization of last resort: eliminate capturing from your regexps
  • Download Code

Replies are listed 'Best First'.
Re^3: An optimization of last resort: eliminate capturing from your regexps
by diotalevi (Canon) on Jul 11, 2006 at 13:15 UTC

    They're not actually ties though. Ties are slow, these aren't.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-24 12:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found