Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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

by Erez (Priest)
on Aug 09, 2012 at 07:26 UTC ( #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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://986428]
[ambrus]: No, you're not doing anything wrong. It's just that our automatic spam filters confuse you with the spammers who post advertisments for online shops of counterfeit branded clothing.
[ambrus]: Or unless you left the title field empty or entered a very short title for the node, but then you'd get a message saying that.
[ambrus]: I hope Corion or some other admin is here and can check the logs to see what the problem is.
[mz2255]: I wish I had an online shop but sadly no. The title field definitly wasn't short, had a perl module in the title with 5-6 additional words.
[ambrus]: you can also try to just post again in case it was some intermittent error
[mz2255]: Tried again, denied. Maybe my code is just so bad the site refuses to post it.

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (13)
As of 2017-10-19 15:36 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (255 votes). Check out past polls.