Real-world Python code 700 times slower than C

Chris Barker chrishbarker at attbi.com
Tue Jan 8 20:41:08 EST 2002


Skip Montanaro wrote:
>     Cliff> "In fact, while the x86 wont kill your program for misaligned
>     Cliff> data, accessing that data will slow your program down...."
> 
> That's almost certainly not the problem here.  I'm pretty certain that all
> malloc packages available to Python have been trained in the art of data
> alignment.

I'm using a Numeric compiled with distutils defaults, on Linux Redhat
6.2, and I thought the compiler was reasonably smart, too.

However... I have little knowledge if the internals of Numpy, but from
working with the API, it appears that the data is in one big char[]
array, so the malloc may not have known that the data was going to be
used as doubles, so it may not have bothered to allign it properly.
Perhaps it is time to cross post this to the Numeric group.

-Chris


-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at attbi.net                ---           ---           ---
                                     ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list