Skip to content

Improve project load/unload performance around linked file mapping#346

Merged
dpoeschl merged 1 commit intodotnet:masterfrom
dpoeschl:1112399HangInProjectStateFork
Feb 16, 2015
Merged

Improve project load/unload performance around linked file mapping#346
dpoeschl merged 1 commit intodotnet:masterfrom
dpoeschl:1112399HangInProjectStateFork

Conversation

@dpoeschl
Copy link
Contributor

When a project with N files is loaded or unloaded, the project will be
forked N times, each time adding or removing one of the N files. For
each of those forks, we need to update the Solution's map of linked
files. The process of updating the linked files map was previously
O(N^2), resulting in an overall O(N^3) project load/unload process. This
change makes makes the linked file map calculation O(1) and therefore
the project load/unload process O(N).

Updating the linked files map was previously O(N^2) because it tried to
account for arbitrary project edits that might have added any number of
files and removed any number of files. However, all project-related
forking actually happens at either the level of the entire project
(which was already special-cased) or at the level of an individual file.
We now handle the case of individual file adds/removes efficiently.

This fixes internal issue 1112399

When a project with N files is loaded or unloaded, the project will be
forked N times, each time adding or removing one of the N files. For
each of those forks, we need to update the Solution's map of linked
files. The process of updating the linked files map was previously
O(N^2), resulting in an overall O(N^3) project load/unload process. This
change makes makes the linked file map calculation O(1) and therefore
the project load/unload process O(N).

Updating the linked files map was previously O(N^2) because it tried to
account for arbitrary project edits that might have added any number of
files and removed any number of files. However, all project-related
forking actually happens at either the level of the entire project
(which was already special-cased) or at the level of an individual file.
We now handle the case of individual file adds/removes efficiently.

This fixes internal issue 1112399
@dpoeschl dpoeschl added Area-IDE Tenet-Performance Regression in measured performance of the product from goals. labels Feb 10, 2015
@dpoeschl dpoeschl self-assigned this Feb 10, 2015
@Pilchie
Copy link
Member

Pilchie commented Feb 10, 2015

👍

dpoeschl added a commit that referenced this pull request Feb 16, 2015
Improve project load/unload performance around linked file mapping
@dpoeschl dpoeschl merged commit b77c92d into dotnet:master Feb 16, 2015
dibarbet pushed a commit to dibarbet/roslyn that referenced this pull request Nov 21, 2025
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE Tenet-Performance Regression in measured performance of the product from goals.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants