Comparison

Chris Angelico rosuav at gmail.com
Mon Sep 22 19:11:09 CEST 2014


On Tue, Sep 23, 2014 at 2:57 AM, LJ <luisjosenovoa at gmail.com> wrote:
> Quick question here. In the code I am working on I am apparently doing a lot of dictionary lookups and those are taking a lot of time.
> I looked at the possibility of changing the structure and I found about the numpy structured arrays.
> The concrete question is: what would be the difference between using one or the other in terms of performance? meaning looping and performing checks an operations on them?

The lookups themselves almost certainly aren't actually taking the
time, unless you have some kind of crazy hash collision happening,
which is so statistically unlikely that it would have to have come
from malice. What's the code doing? What are you trying to accomplish?
It's much more likely that you have an algorithmic flaw than a data
type inefficiency.

ChrisA



More information about the Python-list mailing list