[Bf-committers] Faster listbase lookups

Mathias Panzenböck grosser.meister.morti at gmx.net
Sun Oct 22 14:26:11 CEST 2006


Joe Eagar wrote:
> Campbell Barton wrote:
>> Hey Ed,
>>
>> a Hash table could be an interesting way to do name lookups, and worth 
>> researching...
> Ton suggested this on irc once. . .
> 
> Apparently all ID library lists are alphanumerically sorted most of the 
> time.  Therefor you could try writing a binary search algorithm.  Or 
> just skip ahead through the list four or five entries at a time, until 
> you hit a name alphanumerically greater the the name your searching 
> for.  then go backwards.
> 
> Joe

Well, Python has a hash-table. Would it be somehow possible to reuse this work and not to invite the 
weel once again?

A little self-promotion here:
But if you want to use a AVL-tree in C (in C++ I think std::map is a AVL-tree), you can use mine:
http://twoday.tuwien.ac.at/pub/stories/7589/

I wrote this when we learned about AVL-trees at the university. :)
License: whatever you want so you can use it in blender. LGPL, BSD, ... aslong my name is mentioned. :)

	panzi


More information about the Bf-committers mailing list