# HG changeset patch # User drewp@bigasterisk.com # Date 2015-06-14 05:00:24 # Node ID add6514966f89c7cd2386b5bf0286c72379deced # Parent 9da76bb54c803ee3e4dc71d2f911f21ad3acd4be looking for eval optimizations Ignore-this: ed3028d79f293fafc63facb01c4e26e diff --git a/light9/Submaster.py b/light9/Submaster.py --- a/light9/Submaster.py +++ b/light9/Submaster.py @@ -46,7 +46,7 @@ class Submaster(object): 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), diff --git a/light9/effecteval/effect.py b/light9/effecteval/effect.py --- a/light9/effecteval/effect.py +++ b/light9/effecteval/effect.py @@ -164,6 +164,10 @@ class EffectNode(object): 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)