pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowley@gmail.com>
To: 'Heikki Linnakangas' <heikki.linnakangas@enterprisedb.com>
To: 'Peter Eisentraut' <peter_e@gmx.net>
To: pgsql-patches@postgresql.org
Subject: Re: [HACKERS] TODO item: Implement Boyer-Moore searching (First time hacker)
Date: Sat, 06 Sep 2008 18:50:47 -0400
Message-ID: <26522.1220741447@sss.pgh.pa.us> (raw)
In-Reply-To: <26072.1220739661@sss.pgh.pa.us>
References: <C848A7ECB1E346388B9BD7F7966C0DDC@amd64>
	<26072.1220739661@sss.pgh.pa.us>

I wrote:
> I looked this over a bit and was immediately confused by one thing:
> the introductory comment says that the skip table size ought to be based
> on the length of the haystack, which makes sense to me, but the code is
> actually initializing it on the basis of len2, ie, the length of the
> needle.  Isn't that a bug?  Was the same bug present in the tests you
> made to determine the best table sizes?

BTW, to the extent that you feel like testing a different idea,
I would suggest:

* don't bother initializing the skiptable when len1 < len2

* otherwise, choose its size based on len1 - len2, not just len1 or
len2.  This is (one less than) the maximum number of search loop
consultations of the skip table that can happen, so it seems like a
plausible number, and better than either length alone.

			regards, tom lane



view thread (21+ messages)  latest in thread

Message-ID: <26522.1220741447@sss.pgh.pa.us>
Permalink:  ../26522.1220741447@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26522.1220741447@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-patches@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dgrowley@gmail.com, heikki.linnakangas@enterprisedb.com, peter_e@gmx.net
  Subject: Re: [HACKERS] TODO item: Implement Boyer-Moore searching (First time hacker)
  In-Reply-To: <26522.1220741447@sss.pgh.pa.us>
  References: <C848A7ECB1E346388B9BD7F7966C0DDC@amd64> <26072.1220739661@sss.pgh.pa.us> <26522.1220741447@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox