Re: equal() perf tweak - Mailing list pgsql-patches

From Gaetano Mendola
Subject Re: equal() perf tweak
Date
Msg-id 3FAA2740.40901@bigfoot.com
Whole thread Raw
In response to Re: equal() perf tweak  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:

> Gaetano Mendola <mendola@bigfoot.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


pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: equal() perf tweak
Next
From: Gaetano Mendola
Date:
Subject: Re: equal() perf tweak