Re: [PATCH] backend: compare word-at-a-time in bcTruelen

From: tomas(at)tuxteam(dot)de
To: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
Cc: Jeremy Kerr <jk(at)ozlabs(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
Subject: Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Date: 2009-06-26 15:29:06
Message-ID: 20090626152906.GA948@tomas
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, Jun 26, 2009 at 05:03:11PM +0200, Dimitri Fontaine wrote:
> Le 26 juin 09 à 14:47, Jeremy Kerr a écrit :
>> For the new function to be faster, we need to know that there are more
>> than 6 (on average, depending on alignment) trailing spaces.
>
> It's becoming somewhat tricky, but maybe the test to do for the
> optimisation to get used is n >= threshold && str[n-6] == 0x20, àla
> Boyer/Moore?

That's cute. What about comparing the last aligned word which completely
fits in the buffer? Something along the lines of (assuming four-byte
words)

* (int*) (4 * ((int) &buf[0]) / 4)

(now that's an ugly one, but you know what I mean?)

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFKROlCBcgs9XrR2kYRArHPAJ9VhT+RfK5/5BxwA0nxaOmK4nfuWACdFtFL
iKtvPaZY/KhDJMOf4hyzmQI=
=yd05
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-06-26 15:39:51 Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Previous Message Dimitri Fontaine 2009-06-26 15:03:11 Re: [PATCH] backend: compare word-at-a-time in bcTruelen