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

WIP: projectPreprocessor-perf #441

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/projectPreprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@ class ProjectPreprocessor {
return config.kind === "extension";
});

const projectClone = JSON.parse(JSON.stringify(project));
let projectStringified;
if (extensionConfigs.length) {
// Stringify the project before making modifications
// Using a string to efficiently create multiple independent clones
projectStringified = JSON.stringify(project);
}

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

const extensionProjects = extensionConfigs.map((config) => {
// Clone original project
const configuredProject = JSON.parse(JSON.stringify(projectClone));
const configuredProject = JSON.parse(projectStringified);

// Enhance project with its configuration
Object.assign(configuredProject, config);
Expand Down