dual processor

Paul Rubin http
Tue Sep 6 03:20:23 EDT 2005


Steve Jorgensen <nospam at nospam.nospam> writes:
> Given that Python is highly dependent upon dictionaries, I would
> think a lot of the processor time used by a Python app is spent in
> updating hash tables.  That guess could be right or wrong, bus
> assuming it's right, is that a design flaw?  That's just a language
> spending most of its time handling the constructs it is based on.
> What else would it do?

I don't believe it's right based on half-remembered profiling discussions
I've seen here.  I haven't profiled CPython myself.  However, if tuning
the rest of the implementation makes hash tables a big cost, then the
implementation, and possibly the language, should be updated to not
have to update hashes so much.  For example,

   x.y = 3

currently causes a hash update in x's internal dictionary.  But either
some static type inference or a specializing compiler like psyco could
optimize the hash lookup away, and just update a fixed slot in a table.



More information about the Python-list mailing list