You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Before this change we had few issues with the resolution cache.. It only stored resolutions per file. So when something changed we had to go through map and invalidate the resolutions in each file based on what changed. Because earlier resolution was readonly only object with resolution and failed lookup locations, every resolution is distinct even when resolution in say file "/a/b/c.ts" was reused as resolution from file /a/b/x/d.ts. The difference was that the later resolution would contain more failed lookup locations but everything else will be same. Given the number of resolutions to go through to invalidate them, we use to skip going through resolutions and just re-evaluate them when asked for if program contained more than 256 files. So there was lot of time spent in module resolution on rename of files or some such updates..
This PR makes below changes:
This makes resolutions's failed lookup locations as non readonly array so we can append more failed lookup locations to already present resolution. This also returns same resolution instead of copying the content so we have less number of unique resolutions.
Resolutions with failed lookup locations are stored in separate array so its easier to scan through and invalidate them (since that number is lower compared to number of unique resolutions. In case of vscode 475 resolutions with failed lookup locations compared to 13923 unique resolutions)
We also have a map that is from file the resolution is resolved to. (The max number in this case are 322 in vscode scenario.) Again this makes it easy to invalidate resolutions resolving to certain file.
Here are the number of resolutions for vscode source and rename action in repro
Note that ResolutionsToFile I am listing files only if number of resolutions are more than 100 to that file otherwise list gets long...
Note that vscode has 2227 files in the project
Initial Project creation::
Info 2284 [14:8:43.613] ResolutionCache:: module:: Number of unique resolutions: 13923
Info 2285 [14:8:43.613] ResolutionCache:: module:: Number of loaderInvokes: 14305
Info 2286 [14:8:43.613] ResolutionCache:: typeRef:: Number of unique resolutions: 13
Info 2287 [14:8:43.613] ResolutionCache:: typeRef:: Number of loaderInvokes: 13
Info 2288 [14:8:43.613] ResolutionCache:: Resolutions with failedLookups:: 475
Info 2289 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/lifecycle.ts:: 322
Info 2290 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/uri.ts:: 293
Info 2291 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/event.ts:: 269
Info 2292 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/instantiation/common/instantiation.ts:: 242
Info 2293 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/nls.d.ts:: 216
Info 2294 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/platform.ts:: 197
Info 2295 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/async.ts:: 159
Info 2296 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/configuration/common/configuration.ts:: 146
Info 2297 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/files/common/files.ts:: 130
Info 2298 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/model.ts:: 129
Info 2299 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/browser/dom.ts:: 126
Info 2300 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/path.ts:: 126
Info 2301 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/registry/common/platform.ts:: 126
Info 2302 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/strings.ts:: 125
Info 2303 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/instantiation/common/extensions.ts:: 125
Info 2304 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/types.ts:: 124
Info 2305 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/arrays.ts:: 123
Info 2306 [14:8:43.615] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/log/common/log.ts:: 122
Info 2307 [14:8:43.616] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/core/range.ts:: 120
Info 2308 [14:8:43.616] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/theme/common/themeservice.ts:: 119
Info 2309 [14:8:43.616] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/cancellation.ts:: 118
Info 2310 [14:8:43.616] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/resources.ts:: 117
Info 2311 [14:8:43.616] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/contextkey/common/contextkey.ts:: 117
Info 2312 [14:8:43.616] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/keycodes.ts:: 116
Info 2313 [14:8:43.616] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/modes.ts:: 105
Info 2314 [14:8:43.616] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/network.ts:: 103
Info 2315 [14:8:43.616] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/telemetry/common/telemetry.ts:: 103
Info 2316 [14:8:43.616] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/config/editoroptions.ts:: 101
Rename::
Watch invoked for creation of codeActionRenamed:: (timeout to update vscode config file)
Info 4170 [14:14:42.368] ResolutionCache:: module:: Number of unique resolutions: 16
Info 4171 [14:14:42.368] ResolutionCache:: module:: Number of loaderInvokes: 22
Info 4172 [14:14:42.368] ResolutionCache:: typeRef:: Number of unique resolutions: 0
Info 4173 [14:14:42.368] ResolutionCache:: typeRef:: Number of loaderInvokes: 0
Info 4174 [14:14:42.368] ResolutionCache:: Resolutions with failedLookups:: 477
Info 4175 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/lifecycle.ts:: 323
Info 4176 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/uri.ts:: 294
Info 4177 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/event.ts:: 269
Info 4178 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/instantiation/common/instantiation.ts:: 242
Info 4179 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/nls.d.ts:: 216
Info 4180 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/platform.ts:: 197
Info 4181 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/async.ts:: 159
Info 4182 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/configuration/common/configuration.ts:: 146
Info 4183 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/files/common/files.ts:: 130
Info 4184 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/model.ts:: 129
Info 4185 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/browser/dom.ts:: 126
Info 4186 [14:14:42.371] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/path.ts:: 126
Info 4187 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/registry/common/platform.ts:: 126
Info 4188 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/strings.ts:: 125
Info 4189 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/instantiation/common/extensions.ts:: 125
Info 4190 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/types.ts:: 124
Info 4191 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/arrays.ts:: 124
Info 4192 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/log/common/log.ts:: 122
Info 4193 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/core/range.ts:: 121
Info 4194 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/theme/common/themeservice.ts:: 119
Info 4195 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/cancellation.ts:: 118
Info 4196 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/resources.ts:: 117
Info 4197 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/contextkey/common/contextkey.ts:: 117
Info 4198 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/keycodes.ts:: 116
Info 4199 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/modes.ts:: 106
Info 4200 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/network.ts:: 103
Info 4201 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/telemetry/common/telemetry.ts:: 103
Info 4202 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/errors.ts:: 101
Info 4203 [14:14:42.372] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/config/editoroptions.ts:: 101
UpdateOpen call::
To close codeAction and open renamed file
No Resolutions:: or updates(because timeout happened before)
Open with all the edits::
Info 6358 [14:14:45.215] ResolutionCache:: module:: Number of unique resolutions: 8
Info 6359 [14:14:45.215] ResolutionCache:: module:: Number of loaderInvokes: 8
Info 6360 [14:14:45.215] ResolutionCache:: typeRef:: Number of unique resolutions: 0
Info 6361 [14:14:45.215] ResolutionCache:: typeRef:: Number of loaderInvokes: 0
Info 6362 [14:14:45.215] ResolutionCache:: Resolutions with failedLookups:: 475
Info 6363 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/lifecycle.ts:: 323
Info 6364 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/uri.ts:: 294
Info 6365 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/event.ts:: 269
Info 6366 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/instantiation/common/instantiation.ts:: 242
Info 6367 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/nls.d.ts:: 216
Info 6368 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/platform.ts:: 197
Info 6369 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/async.ts:: 159
Info 6370 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/configuration/common/configuration.ts:: 146
Info 6371 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/files/common/files.ts:: 130
Info 6372 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/model.ts:: 129
Info 6373 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/browser/dom.ts:: 126
Info 6374 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/path.ts:: 126
Info 6375 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/registry/common/platform.ts:: 126
Info 6376 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/strings.ts:: 125
Info 6377 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/instantiation/common/extensions.ts:: 125
Info 6378 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/types.ts:: 124
Info 6379 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/arrays.ts:: 124
Info 6380 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/log/common/log.ts:: 122
Info 6381 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/core/range.ts:: 121
Info 6382 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/theme/common/themeservice.ts:: 119
Info 6383 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/cancellation.ts:: 118
Info 6384 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/resources.ts:: 117
Info 6385 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/contextkey/common/contextkey.ts:: 117
Info 6386 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/keycodes.ts:: 116
Info 6387 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/modes.ts:: 106
Info 6388 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/network.ts:: 103
Info 6389 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/platform/telemetry/common/telemetry.ts:: 103
Info 6390 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/base/common/errors.ts:: 101
Info 6391 [14:14:45.216] ResolutionCache:: ResolutionsToFile: c:/github/vscode/src/vs/editor/common/config/editoroptions.ts:: 101
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this change we had few issues with the resolution cache.. It only stored resolutions per file. So when something changed we had to go through map and invalidate the resolutions in each file based on what changed. Because earlier resolution was readonly only object with resolution and failed lookup locations, every resolution is distinct even when resolution in say file "/a/b/c.ts" was reused as resolution from file
/a/b/x/d.ts
. The difference was that the later resolution would contain more failed lookup locations but everything else will be same. Given the number of resolutions to go through to invalidate them, we use to skip going through resolutions and just re-evaluate them when asked for if program contained more than 256 files. So there was lot of time spent in module resolution on rename of files or some such updates..This PR makes below changes:
Here are the number of resolutions for vscode source and rename action in repro
Note that ResolutionsToFile I am listing files only if number of resolutions are more than 100 to that file otherwise list gets long...
Note that vscode has 2227 files in the project
This fixes #30535