[Numpy-discussion] Optimizing a pure Python Workaround

Ian Mallett geometrian@gmail....
Mon Jul 13 18:11:13 CDT 2009


I have some code that makes vertex buffer object terrain.  Because the setup
for this (a series of triangle strips) is a bit clunky, I just implemented
the tricky parts in Python.

The code works, but it's slow.  How should I go about optimizing it?



size = [#int_something,#int_something_else]
fsize = map(float,size)
array = []
for x in xrange(size[0]):
    for y in xrange(size[1]):
        array.append(np.array([ x   /fsize[0],y/fsize[1],0.0],"f"))
array = np.array(array)
#"array" is the final product.  I need this final product generated more
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090713/53ec1570/attachment.html 

More information about the NumPy-Discussion mailing list