use numpy to shave 4 seconds off of sugar startup

This commit is contained in:
John (J5) Palmieri 2007-08-17 17:57:05 -04:00
parent 5ebc0c8212
commit 735b0cf2c8

View File

@ -15,7 +15,7 @@
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA. # Boston, MA 02111-1307, USA.
from array import array from numpy import array
from random import random from random import random
import hippo import hippo
@ -41,9 +41,8 @@ class _Grid(gobject.GObject):
self._collisions = [] self._collisions = []
self._collisions_sid = 0 self._collisions_sid = 0
self._array = array('B') self._array = array([0], dtype='b')
for i in range(width * height): self._array.resize(width * height)
self._array.append(0)
def add(self, child, width, height): def add(self, child, width, height):
trials = _PLACE_TRIALS trials = _PLACE_TRIALS