Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Prior to this commit, state forks would deep clone potentially quite large value trees. This would create many duplicated values that were then incorporated into further trees.
Now, rather than having unique ownership of each tree node using
Box<T>
, the analyzer instead shares these as much as possible through use ofArc<T>
. This has resulted in significant improvements in memory usage, and similarly significant improvements to execution time by eliminating the need to perform many allocations.In addition to this, we are also more careful about how we retain values. When transforming
RSV
toTCSV
, we would previously retain the vector of all runtime values until all of those values had been transformed. Now we drop runtime values eagerly wherever possible. This has resulted in a reduction to peak residency.As part of this work, some investigation was done as to the quadratic traversal of value trees in the
InferenceState
during transformation. While a variety of single-pass approaches were tried, the current approach managed to outperform all of them. A comment has been added to indicate this, and to be careful when changing it.Closes #69
Closes #79
Closes #85
Details
Just the usual things.
Checklist