Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Matching simple patterns - is there a faster way?

by Erez (Priest)
on Aug 09, 2012 at 07:26 UTC ( [id://986428]=note: print w/replies, xml ) Need Help??


in reply to Matching simple patterns - is there a faster way?

is regex matching the fastest way to go?

Depends. In Perl it probably is, being a well implemented algorithm. In general it's not, since the regex algorithm isn't as fast as the one you find in Unix grep and similar, but is more robust and allows for a lot of clever and powerful matching.

But that's obviously the wrong question, given that a: this looks like a premature optimization, and b: Perl isn't that fast to begin with, due to a lot of stuff that goes behind the scenes which allows for all the flexibility and DWIMability. A better, I believe, course would be to profile the entire program run, see what are the bottlenecks and then figure how to better iron them out, rather than assuming the regex engine will be your biggest problem, rather than, say, Perl's IO.

Principle of Least Astonishment: Any language that doesn’t occasionally surprise the novice will pay for it by continually surprising the expert

  • Comment on Re: Matching simple patterns - is there a faster way?

Replies are listed 'Best First'.
Re^2: Matching simple patterns - is there a faster way?
by mrguy123 (Hermit) on Aug 09, 2012 at 07:55 UTC
    Hi Erez, you're correct that the bottleneck is not the regex matching (it is the HTML downloading). However, if I can make the regex matching a bit faster it will be helpful
    Also, as I mentioned before, this is I think an interesting question that I would like to hear the Monks opinion on

    BTW, I enjoyed your talk on "The view from under the bridge" in the Israeli Perl Workshop earlier this year

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-20 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found