# HG changeset patch # User drewp@bigasterisk.com # Date 1434258024 0 # Node ID add6514966f89c7cd2386b5bf0286c72379deced # Parent 9da76bb54c803ee3e4dc71d2f911f21ad3acd4be looking for eval optimizations Ignore-this: ed3028d79f293fafc63facb01c4e26e diff -r 9da76bb54c80 -r add6514966f8 light9/Submaster.py --- 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), diff -r 9da76bb54c80 -r add6514966f8 light9/effecteval/effect.py --- 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)