Re: [PATCH] backend: compare word-at-a-time in bcTruelen - Mailing list pgsql-hackers

From Jeremy Kerr
Subject Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Date
Msg-id 200906262047.00727.jk@ozlabs.org
Whole thread Raw
In response to Re: [PATCH] backend: compare word-at-a-time in bcTruelen  (Stephen Frost <sfrost@snowman.net>)
Responses Re: [PATCH] backend: compare word-at-a-time in bcTruelen  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [PATCH] backend: compare word-at-a-time in bcTruelen  (Dimitri Fontaine <dfontaine@hi-media.com>)
List pgsql-hackers
Stephen,

> If the updated function is always faster when the overall string is at
> least, say, 16 characters long,

But that's not the case - the cost of the function (and the speedup from 
the previous version) depends on the number of spaces that there are at 
the end.

For the new function to be faster, we need to know that there are more 
than 6 (on average, depending on alignment) trailing spaces. The number 
of non-space characters in the string won't affect performance (other 
than that there is probably a correlation between total string length 
and number of spaces, but we can't be certain of that).

> If the new function is always slower, regardless of overall string
> length, when there's only 1 extra space at the end

Yes, that is correct.

Cheers,


Jeremy



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Next
From: Tom Lane
Date:
Subject: gettext version problem exposed by buildfarm failures on "canary"