Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: In search of an efficient query abstractor

by mpeg4codec (Pilgrim)
on Dec 07, 2008 at 22:05 UTC ( #728803=note: print w/replies, xml ) Need Help??


in reply to Re^4: In search of an efficient query abstractor
in thread In search of an efficient query abstractor

yacc requires the grammar to be LALR, which I agree belongs in the ninth circle of hell. The grammar on the MySQL pages is an unspecified sort of context free grammar and I believe RecDescent supports that.

This is pretty similar to the HTML parsing debate (which never seems to end). You want to get some data out of an HTML page? Go with regex. Want to do anything related to the structure of the HTML and actually parse it? Definitely go with one of the parser modules.

Analogously, since you're trying to poke around the structure of SQL statements, my recommendation still stands. OTOH, I can understand resistance with regard to picking up RecDescent for a relatively straightforward task such as this one.

Best of luck!

  • Comment on Re^5: In search of an efficient query abstractor

Replies are listed 'Best First'.
Re^6: In search of an efficient query abstractor
by tilly (Archbishop) on Dec 08, 2008 at 08:21 UTC
    I would recommend strongly against Parse::RecDescent for this. That was written before the /g modifier existed in Perl and so every time it matches a token it makes a copy of everything that comes after the token. On even a fairly small data set this can take a prohibitive amount of time and memory.

    Changing that would entail rewriting the whole module. TheDamian had plans to do this, but I don't know if it ever happened. He did tell me that said rewrite was going to have to be incompatible with the original in some ways.

      Why isn't this important fact in the perldoc?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://728803]
help
Chatterbox?
[ambrus]: So that, or if you really want something agnostic to the loop, then use curl multi. Its interface is quite reasonable (unless you use an old version),
[ambrus]: though it's very C-like (serious use of varargs so easy to pass the wrong type), and there are some minor problems (busy loop because it doesn't use the same timer as your event loop, so you have to artificially delay timer callbacks by a small amount).

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2016-12-07 16:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (130 votes). Check out past polls.