This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch tristan/partial-variables-manual-string-join in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 727533c666d67f875b64dbe8889ca7de75157447 Author: Tristan van Berkom <[email protected]> AuthorDate: Wed Jul 1 20:00:24 2020 +0900 _variables.py: Revert to using `list` time in favor of ValueLink objects Since ValueLink needs to be allocated in the loop, it's unclear whether this is more performant than pushing values onto a python list and then popping them off later on. --- src/buildstream/_variables.pyx | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/buildstream/_variables.pyx b/src/buildstream/_variables.pyx index 2a01b1c..245cbab 100644 --- a/src/buildstream/_variables.pyx +++ b/src/buildstream/_variables.pyx @@ -243,8 +243,7 @@ cdef class Variables: # Each iteration processes a ResolutionStep object and has the possibility # to enque more ResolutionStep objects as a result. # - cdef ValueLink deps = None - cdef ValueLink dep = None + cdef list deps = [] cdef bint first_iteration = True step = ResolutionStep() @@ -272,10 +271,7 @@ cdef class Variables: # Queue up this value to be resolved in the next loop if iter_value._resolved is None: - dep = ValueLink() - dep.value = iter_value - dep.prev = deps - deps = dep + deps.append(iter_value) # Queue up it's dependencies for resolution iter_value_deps = iter_value.dependencies() @@ -293,8 +289,8 @@ cdef class Variables: # we want to return. # while deps: - resolved_value = deps.value.resolve(self._values) - deps = deps.prev + iter_value = deps.pop() + resolved_value = iter_value.resolve(self._values) return resolved_value @@ -413,15 +409,6 @@ cdef class ResolutionStep: detail="\n".join(reversed(error_lines))) -# ValueLink -# -# A link list for Values. -# -cdef class ValueLink: - cdef Value value - cdef ValueLink prev - - # ValuePart() # # Represents a part of a value (a string and an indicator
