Code speedup tips

Frank Buss fb at frank-buss.de
Sun Mar 9 08:11:06 EST 2003


Thanks for all the tips. I've updated my page, using a class for hiding all 
the slice handling:

http://www.frank-buss.de/automaton/rule30.html

But I think for the calculation of the sum of all 1's, it could be faster. 
Currently it is implemented like this:

# print the number of '1's for all automaton steps
for step in range(length / 2):
  print reduce(lambda x, y: x+y, rule30.current) 
  rule30.step()

Where 'current' is a Numeric's array. Any tips?

Another optimization idea: using only 1 bit for every cell, instead of a 
full Int.

PS: for 2D cellular optimization see http://cell-auto.com/optimisation/

-- 
Frank Buß, fb at frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de




More information about the Python-list mailing list