Skip to content

Commit

Permalink
perf(framework): avoid unnecessary config graph cloning (#6667)
Browse files Browse the repository at this point in the history
Co-authored-by: Steffen Neubauer <steffen@garden.io>
  • Loading branch information
vvagaytsev and stefreak authored Nov 21, 2024
1 parent 3166c1f commit f15dd91
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions core/src/graph/config-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import toposort from "toposort"
import { flatten, difference, mapValues, cloneDeep, find } from "lodash-es"
import { flatten, difference, mapValues, find } from "lodash-es"
import { dedent, naturalList } from "../util/string.js"
import type { Action, ActionDependencyAttributes, ActionKind, Resolved, ResolvedAction } from "../actions/types.js"
import { actionReferenceToString } from "../actions/base.js"
Expand Down Expand Up @@ -137,19 +137,6 @@ export abstract class BaseConfigGraph<
// TODO-0.13.0: checks for circular dependencies
}

clone() {
const clone = new ConfigGraph({
environmentName: this.environmentName,
actions: [],
moduleGraph: this.moduleGraph,
groups: Object.values(this.groups),
})
for (const key of Object.getOwnPropertyNames(this)) {
clone[key] = cloneDeep(this[key])
}
return clone
}

/////////////////
// For compatibility
getModule(name: string, includeDisabled?: boolean) {
Expand Down Expand Up @@ -557,8 +544,8 @@ export class MutableConfigGraph extends ConfigGraph {
})
}

toConfigGraph() {
return this.clone()
toConfigGraph(): ConfigGraph {
return this
}
}

Expand Down

0 comments on commit f15dd91

Please sign in to comment.