How to increase the speed of this program?

HYRY zhangry at feng.co.jp
Tue Nov 28 03:53:15 EST 2006


I think
oarray = array.array("h", [0]*(len(larray)+len(rarray))) #1
oarray[0::2] = larray                                    #2
oarray[1::2] = rarray                                    #3
will be executed at C level, but if I use itertools, the program is
executed at Python level. So the itertools version is actually slower
than the original program.
I tested #1,#2,#3. the speed of #2 and #3 is OK, but #1 is slow.
So my question is : are there some methods to create a huge array
without an initializer?




More information about the Python-list mailing list