changeset 1272:add6514966f8

looking for eval optimizations Ignore-this: ed3028d79f293fafc63facb01c4e26e
author drewp@bigasterisk.com
date Sun, 14 Jun 2015 05:00:24 +0000
parents 9da76bb54c80
children b400924f83e7
files light9/Submaster.py light9/effecteval/effect.py
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/light9/Submaster.py	Sun Jun 14 05:00:01 2015 +0000
+++ b/light9/Submaster.py	Sun Jun 14 05:00:24 2015 +0000
@@ -46,7 +46,7 @@
         return self.levels
 
     def no_nonzero(self):
-        return (not self.levels.values()) or not (max(self.levels.values()) > 0)
+        return all(v == 0 for v in self.levels.itervalues())
 
     def __mul__(self, scalar):
         return Submaster("%s*%s" % (self.name, scalar),
--- a/light9/effecteval/effect.py	Sun Jun 14 05:00:01 2015 +0000
+++ b/light9/effecteval/effect.py	Sun Jun 14 05:00:24 2015 +0000
@@ -164,6 +164,10 @@
             currentSubLevel=self.currentSubLevel,
             ))
 
+        # I think this is slowing effecteval. Could we cache results
+        # that we know haven't changed, like if a curve returns 0
+        # again, we can skip an eval() call on the line that uses it
+        
         for c in self.codes:
             codeNs = ns.copy()
             codeNs.update(c.pyResources)