Re: equal() perf tweak

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: equal() perf tweak
Date: 2003-11-06 10:49:11
Message-ID: 3FAA2727.2020502@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:

> Gaetano Mendola <mendola(at)bigfoot(dot)com> writes:
>
>>[ use list with master node and circular linking ]
>
>
>>now is very late here ( 04:17 AM ) so I wrote
>>the wrong code ( not checked ) but show the idea of
>>avoid "if".
>
>
> This saves an "if" during addition of a list item, at the cost of
> greater expense during list traversal. (Instead of a loop termination
> test like "ptr != NULL", you need something like "ptr != master_node".
> This may not take an extra cycle, but only if you can afford to dedicate
> a register to holding the value of master_node within the loop. That
> hurts, especially on architectures with not very many registers.)

Well, if the same architecture have not so many register I guess don't
have a double prefetch instruction queue and an "if" branch
will hurt/destroy that queue, am I wrong ?

I'm going to post on comp.lang.c++.moderated and
comp.std.c++ in order to have better argumentations

> Anyway, we should build the code that way and then do profiling with and
> without support for constant-cost length().

I totally agree with you.

Regards
Gaetano Mendola

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gaetano Mendola 2003-11-06 10:49:36 Re: equal() perf tweak
Previous Message Peter Eisentraut 2003-11-06 10:26:58 Re: Changes to Contributor List

Browse pgsql-patches by date

  From Date Subject
Next Message Gaetano Mendola 2003-11-06 10:49:36 Re: equal() perf tweak
Previous Message Tom Lane 2003-11-06 05:28:38 Re: equal() perf tweak