From 353ab16db64c86122c0fcb9e1852b85c14b354b8 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Fri, 3 Dec 2010 04:20:17 -0500 Subject: Speed optimizations abound! Caching on parameter validation, Binary searching for light locations in pixel mappers, actual thread safety for inputs means we don't drop them randomly, anymore. Caching on PixelStates to reduce multi-renderer costs + a short circuit to speed up processing on pixels that are turned off. --- operationscore/Behavior.py | 3 ++- operationscore/Input.py | 3 +++ operationscore/SmootCoreObject.py | 6 ++---- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'operationscore') diff --git a/operationscore/Behavior.py b/operationscore/Behavior.py index e300f6b..83d2e7d 100644 --- a/operationscore/Behavior.py +++ b/operationscore/Behavior.py @@ -56,5 +56,6 @@ class Behavior(SmootCoreObject): try: return outputs except: - pdb.set_trace() + pass + #pdb.set_trace() return outputs diff --git a/operationscore/Input.py b/operationscore/Input.py index 67a7bb0..9ee59f8 100644 --- a/operationscore/Input.py +++ b/operationscore/Input.py @@ -32,7 +32,10 @@ class Input(threading.Thread): def respond(self, eventDict): #if eventDict != []: #pdb.set_trace() + self.parentScope.lock.acquire() self.parentScope.processResponse(self.argDict, eventDict) + self.parentScope.lock.release() + time.sleep(.001) def newEvent(self, event): #Mostly just useful for grabbing events from the #computer running the sim (key presses, clicks etc.) self.eventQueue.append(event) diff --git a/operationscore/SmootCoreObject.py b/operationscore/SmootCoreObject.py index 84319af..d29e710 100644 --- a/operationscore/SmootCoreObject.py +++ b/operationscore/SmootCoreObject.py @@ -21,10 +21,8 @@ class SmootCoreObject: def __getiter__(self): return self.argDict.__getiter__() def validateArgs(self, argFileName): - try: - self.validateArgDict(Util.loadParamRequirementDict(argFileName)) - except IOError: - print 'No Arg Dict found for ' + self.className() + self.validateArgDict(Util.loadParamRequirementDict(argFileName))#util + #caches for us, woo! def validateArgDict(self, validationDict): for item in validationDict: if not item in self.argDict: -- cgit v1.2.3