Skip to content

Commit c8bb1f2

Browse files
committed
WIP: projectPreprocessor-perf
1 parent 0072815 commit c8bb1f2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/projectPreprocessor.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,12 @@ class ProjectPreprocessor {
231231
return config.kind === "extension";
232232
});
233233

234-
const projectClone = JSON.parse(JSON.stringify(project));
234+
let projectStringified;
235+
if (extensionConfigs.length) {
236+
// Stringify the project before making modifications
237+
// Using a string to efficiently create multiple independent clones
238+
projectStringified = JSON.stringify(project);
239+
}
235240

236241
// While a project can contain multiple configurations,
237242
// from a dependency tree perspective it is always a single project
@@ -255,7 +260,7 @@ class ProjectPreprocessor {
255260

256261
const extensionProjects = extensionConfigs.map((config) => {
257262
// Clone original project
258-
const configuredProject = JSON.parse(JSON.stringify(projectClone));
263+
const configuredProject = JSON.parse(projectStringified);
259264

260265
// Enhance project with its configuration
261266
Object.assign(configuredProject, config);

0 commit comments

Comments
 (0)