Real-world Python code 700 times slower than C
Cliff Wells
logiplexsoftware at earthlink.net
Tue Jan 8 17:37:59 EST 2002
On Tue, 08 Jan 2002 12:54:07 -0800
Chris Barker <chrishbarker at attbi.com> wrote:
> I tried re-writing your code with doubles, and it ended up more than
> four times slower, so now I know why you did it.
>
> Anyone know why this is? I can see that twice as much memory has to be
> allocated, de-allocated, and passed around, but that wouldn't account
> for a 4X slow down. Can anyone offer an explanation?
>
Perhaps it isn't the floats vs doubles per se, but rather has to do with
memory-boundary alignment issues when the doubles are stored in an array.
I'm not sure of the storage requirements for floats/doubles on VC++, but
it may be that the floats end up aligned and the double aren't. Maybe
there's an option to VC++ to force this (at the cost of higher memory
utilization)?
--
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308
More information about the Python-list
mailing list