Efficient searching through objects

Tim Rowe digitig at gmail.com
Thu Feb 26 08:25:29 EST 2009


2009/2/26 sert <jerry at hotmail.com>:
> bearophileHUGS at lycos.com wrote in
> news:37632421-5475-4859-be83-07ae2eca1773 at r4g2000yqa.googlegro
> ups.com:
>
>> Try using a dict instead, where keys are the names and
>> objects the values (it turns a linear search in a quick
>> hash look up). . Then tell us the performance changes.
>>
>
> It halved the overall execution time. Thanks.

Good to see that you've already got an improvement. For what it's
worth, this seems to be classic relational database stuff, and a
relational database will be optimised to do these operations and so is
likely to be faster still. I think there are a couple that Python
works well with, but I've never looked into that -- others will no
doubt be along with recommendations now I've raised the subject.

-- 
Tim Rowe



More information about the Python-list mailing list