Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Perl regexp matching is slow??

by itub (Priest)
on Feb 02, 2007 at 08:59 UTC ( #597909=note: print w/replies, xml ) Need Help??

in reply to Perl regexp matching is slow??

The perl regular expression engine could be seen as an example of "worse is better" (I mean it as a compliment ;-) It might not be the prettiest from some theoretical point of view, it might have pathological cases, but it exists and gets the job done. Sure, it would be great if it had no pathological cases. I have to say that I have never encountered one in real life, but I always feel a bit uneasy letting users of a website run regular expressions via a CGI script due to the risk that they will input a pathological expression just for fun (you can set a timeout, but it's a bit of a pain).

Replies are listed 'Best First'.
Re^2: Perl regexp matching is slow??
by demerphq (Chancellor) on Feb 02, 2007 at 09:56 UTC

    You could also use the expression "perfect is the enemy of good".

    Sure the perl engine is not that perfect (in fact in many respects its a heap of steaming excrement that happens to work only because some guy named Zaphod and the Infinite Improbability drive happened to be passing by at the time it was compiled), but its good enough, has proved itself to be a powerful tool and has done more than all the other regex implementations put together to advance the programming communities knowledge and exposure to regular expressions.

    Also given your link I find it amusing that rsc is from MIT. :-)


Re^2: Perl regexp matching is slow??
by diotalevi (Canon) on Feb 02, 2007 at 16:29 UTC

    I think you'll find it difficult to abort the regexp engine since perl's safe-signals can be caught before and after the pattern match but not during. If you were using POSIX::sigaction, perhaps.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      Why not make long-running instructions like pattern matches check for safe signals periodically?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://597909]
[ambrus]: I'm not trying to recommend PHP, but I think it has way too bad a name because of its past.
[ambrus]: This is different from MS Word, which was already a good editor in the pre-unicode days (in word for windows versions 2 and 6, which ran on windows 3 but also on windows 95), only it wasn't trying to solve the task of writing maths papers back then.
[Discipulus]: ah ok, sounds reasonable; with no fear: Perl all life long
[ambrus]: Mind you, LaTeX is currently still useful for writing math paper or snippet content without styling in such a way that the
[ambrus]: formatting conventions of a journal or website can be quickly applied to it, and MS Office and LibreOffice has not quite solved this (although it's better for this than it used to be),
[ambrus]: which is sort of a drawback compared to the ages of typewritten manuscripts representing content only to which the typesetter applies formatting, but that process required much more manual labor.
[ambrus]: If you want to typeset a manuscript, you can still do much less work then in the manual typesetting ages and get good formatting.
[ambrus]: All with only cheap modern computers and software.
[ambrus]: Something you can have at home and your corner print shop, without a whole printing press's worth of equipment.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2017-09-26 11:14 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (293 votes). Check out past polls.