Re: tsearch in core patch, for inclusion

From: Markus Schiltknecht <markus(at)bluegap(dot)ch>
To: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tsearch in core patch, for inclusion
Date: 2007-02-21 14:32:12
Message-ID: 45DC57EC.1010909@bluegap.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Hi,

Florian G. Pflug wrote:
> According to http://en.wikipedia.org/wiki/LR_parser processing one
> token in any LR(1) parser in the worst case needs to
> a) Do a lookup in the action table with the current (state, token) pair
> b) Do a lookup in the goto table with a (state, rule) pair.
> c) Push one state onto the stack, and pop n states with
> n being the number of symbols (tokens or other rules) on the right
> hand side of a rule.
>
> a) and b) should be O(1). Processing one token pushes at most one state
> onto the stack, so overall no more than N stats can be popped off again,
> making the whole algorithm O(N) with N being the number of tokens of the
> input stream.

Looks correct, thanks. What exactly is Tom worried about, then?

>> Are there any ongoing efforts to rewrite the parser (i.e. using
>> another algorithm, like a recursive descent parser)?
> Why would you want to do that?

I recall having read something about rewriting the parser. Together with
Tom being worried about parser performance and knowing GCC has switched
to a hand written parser some time ago, I suspected bison to be slow.
That's why I've asked.

Regards

Markus

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2007-02-21 14:38:41 Re: --enable-xml instead of --with-libxml?
Previous Message Phil Currier 2007-02-21 14:25:09 Re: Column storage positions

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2007-02-21 14:38:41 Re: --enable-xml instead of --with-libxml?
Previous Message Zdenek Kotala 2007-02-21 14:28:06 Re: BUG #2969: Inaccuracies in Solaris FAQ