vinjvinj wrote: > I read some of the earlier threads which essentially said that numpy is > about 3-4 times slower then Numeric for smaller arrays. I'm assuming > that applies only to operations that apply to the whole arrays. > > I was curious how the performance of the following operations would > compare though: > 1. Copying arrays > 2. Creating arrays > 3. Slicing Arrays >
It is really hard to say unless you show specific applications: But, here are some facts. 1) NumPy is in C just like Numeric 2) NumPy is more flexible than Numeric and that means a few more if-statements and checks which can slow-down array creation and slicing. 3) Some optimizations have been done to remove unnecessary slowness (e.g. unnecessary checking but more could be done). 4) Ufuncs have more overhead primarily because of a) the ability to alter how errors are obtained using local / global variables (these must be looked-up in a dictionary which is most of the source of any performance penalty), b) the ability for other objects that can be converted to arrays to interact with ufuncs so that the original object is returned by the ufuncs c) the fact that excessive copying is not done in order to type-cast from one array to annother, this requires some "set-up" overhead My understanding is that most of the "slow-downs" reported for small arrays can be attributed to ufuncs, but there will be slower paths through the C-code for other cases as well because of the increased flexibility. Our goal is to be as fast as we can be so give it a spin and tell us how to improve... Thanks, -Travis -- http://mail.python.org/mailman/listinfo/python-list