Yup.  It was faster to:

 

 Use lists for the append, then transform into an array, then transform into a binary string

 

Rather than

 

Create empty arrays and use its append method, then transform into a binary string.

 

The last question on the output when then be to test the speed of using generic Python arrays, which have append methods as well.  Then, there would still only be the binary string conversion as apposed to listànumpy arrayàbinary string

 

Thanks to all for your input….

 

MJ

 


From: numpy-discussion-bounces@scipy.org [mailto:numpy-discussion-bounces@scipy.org] On Behalf Of Charles R Harris
Sent: Tuesday, February 13, 2007 12:44 PM
To: Discussion of Numerical Python
Subject: Re: [Numpy-discussion] fromstring, tostring slow?

 

 


I am going to guess that a list would be faster for appending. Concat and, I suspect, append make new arrays for each use, rather like string concatenation in Python. A list, on the other hand, is no doubt optimized for adding new values. Another option might be using PyTables with extensible arrays. In any case, a bit of timing should show the way if the performance is that crucial to your application.

Chuck