Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(perf): Make getAncestors call faster #3306

Merged
merged 3 commits into from
Feb 27, 2020

Commits on Feb 27, 2020

  1. 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
    marchello2000 committed Feb 27, 2020
    Configuration menu
    Copy the full SHA
    3d62585 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    43964f9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    19a6294 View commit details
    Browse the repository at this point in the history