Currently, equal() does the following for List nodes:
case T_List:
{
List *la = (List *) a;
List *lb = (List *) b;
List *l;
/*
* Try to reject by length check before we grovel through
* all the elements...
*/
if (length(la) != length(lb))
return false;
foreach(l, la)
{
if (!equal(lfirst(l), lfirst(lb)))
return false;
lb = lnext(lb);
}
retval = true;
}
break;
This code is inefficient, however: length() requires iterating through
the entire list, so this code scans both lists twice. The attached patch
improves this by implementing equal() with a single scan of both lists.
-Neil
Responses
pgsql-hackers by date
| Next: | From: Andrew Sullivan | Date: 2003-11-03 14:16:37 |
| Subject: Re: adding support for posix_fadvise() |
| Previous: | From: Neil Conway | Date: 2003-11-03 13:50:00 |
| Subject: Re: adding support for posix_fadvise() |
pgsql-patches by date
| Next: | From: Tom Lane | Date: 2003-11-03 15:00:25 |
| Subject: Re: bufmgr code cleanup |
| Previous: | From: Jan Wieck | Date: 2003-11-03 13:31:55 |
| Subject: Re: bufmgr code cleanup |