[Bf-committers] Faster listbase lookups

Alexander Ewering blender at instinctive.de
Sat Oct 21 15:48:48 CEST 2006

On Sat, 21 Oct 2006, Campbell Barton wrote:

> My understanding of threads is limited, but I was thinking
> one thing that could improve performance on large ListBases is a way to 
> thread ListBase searches so 2 threads would search starting at each end of 
> the listBase and check up with (eachother every ~50 or so iterations to see 
> if they have found the item thats being searched for)

I see no need for threads here... why not just do something like

for (forward = list->first, backward = list->last, i = 0;
      forward != backward;
      forward = forward->next, backward = backward->prev, i++)

 	item = (i&1) ? forward:backward;

 	if (item->foo) ...

(untested :)

| alexander ewering              instinctive mediaworks
| ae[@]instinctive[.]de   http://www[.]instinctive[.]de

More information about the Bf-committers mailing list