Best way to hash a dictionary
Miki Tebeka
tebeka at cs.bgu.ac.il
Wed Mar 5 09:03:24 EST 2003
Hello Alex,
> > It might not be the main performance bottleneck but everything that
> > will slow me down is usually bad.
> ...
> > When you use a user defined class instread of built in type you lose
> > some performance (3% from my testing on hashes)
>
> Ah, we have a "philosophical" problem here.
Almost all problems boils down to philosophy at the end.
> If ANY performance
> issue is intolerable, to the point that a 3% slowdown on SOME
> parts of your code is something you must consider in deciding
> your design, then Python is surely the wrong tool, and I would
> suggest you also eschew C++ in favour of carefully hand optimized
> machine code -- not even the best optimizing compiler can make
> sure it won't lose some 3% here or there.
I don't want to move to C. The current speed will do, just wanted to
squeeze some more speed from Python. Most of the optimization is done
by psyco (which optimize built-in types much better that user
classes).
> You say you don't profile because profiling slows down your
> runs. Yes, but profiling is also the ONLY sensible way to
> find out what you must optimize. Surely you can arrange a
> "smaller" but still significant run ...
I did profile on a small sample. I'm currently implementing a new
algorithm that should solve the problem.
> ... e.g. if you're
> now chugging along (for example) on a Pentium-3 machine
> running Windows, the best single optimization you can
> make might be to switch to a good new Athlon with DDR
> and FreeBSD (other free Unix-like systems are not far, but
> for sheer performance I think FreeBSD's still on top).
The university kindly provided dual P4 2.3Mhz with 1MB of RAM.
(Running Mandrake I think.)
Thanks for all your trouble. It was enlighting to read your posts (as
ever).
Miki
More information about the Python-list
mailing list