On Fri, May 04, 2007 at 03:42:45PM -0400, Tom Lane wrote:
> It's hardly credible that you could do either strcmp or strcoll in 2 nsec
> on any run-of-the-mill hardware.  What I think is happening is that the
> compiler is aware that these are side-effect-free functions and is
> removing the calls entirely, or at least moving them out of the loops;
> these times would be credible for loops consisting only of an increment,
> test, and branch.

It's not the compiler, it's the C library. strcmp and strcoll are
defined as:

  extern int strcoll (__const char *__s1, __const char *__s2)
     __THROW __attribute_pure__ __nonnull ((1, 2));

In this context "pure" is essentially what IMMUTABLE is in postgres.

Which doesn't change the fact that strcoll is expensive.

Have a nice day,
-- 
Martijn van Oosterhout   <[EMAIL PROTECTED]>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to 
> litigate.

Attachment: signature.asc
Description: Digital signature

Reply via email to