-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(perf): Make
getAncestors
call faster
This change unrolls the recursion of the `getAncestorImpl` call into an imperative call. getAncestors is actually called A TON! (especially since all `context.get` evaluations depend on it). If the execution depth is large (e.g. canary with many stages) this call can take a while and, in some cases, throw a StackOverflow excetion. Additionally, I added some logic to cache the `getAncesors` calls in the expression evaluation as it can't change For context: `getAncestors` is executed 64 times for a simple wait stage execution Results: Time for `getAncestors` was reduced by a factor of 7x (1000 executions on 100 stage pipeline went from 7.2s to 0.9s) Further more, due to caching the number of calls to `getAncestors` is reduces by ~3 (from 64 to 19) So a total improvement time about 21x As another example, planning a kayenta stage with 300 intervals went from 23.6s to 1.2s
- Loading branch information
1 parent
7ee2ac3
commit 19a1438
Showing
2 changed files
with
63 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters