From 735b0cf2c8a5c85b89a0b82d4fc1f40ec6ab5d12 Mon Sep 17 00:00:00 2001 From: "John (J5) Palmieri" Date: Fri, 17 Aug 2007 17:57:05 -0400 Subject: [PATCH] use numpy to shave 4 seconds off of sugar startup --- sugar/graphics/spreadlayout.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sugar/graphics/spreadlayout.py b/sugar/graphics/spreadlayout.py index 931dc19d..7bd1ff12 100644 --- a/sugar/graphics/spreadlayout.py +++ b/sugar/graphics/spreadlayout.py @@ -15,7 +15,7 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. -from array import array +from numpy import array from random import random import hippo @@ -41,9 +41,8 @@ class _Grid(gobject.GObject): self._collisions = [] self._collisions_sid = 0 - self._array = array('B') - for i in range(width * height): - self._array.append(0) + self._array = array([0], dtype='b') + self._array.resize(width * height) def add(self, child, width, height): trials = _PLACE_TRIALS