[Numpy-discussion] fromstring, tostring slow?

Mark Janikas mjanikas at esri.com
Tue Feb 13 16:24:09 EST 2007


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 at scipy.org
[mailto:numpy-discussion-bounces at 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

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070213/32085549/attachment.html>


More information about the NumPy-Discussion mailing list