Skip to content

Conversation

weswigham
Copy link
Member

Fixes a perf issue I noticed while looking at #48278 - we were always unconditionally redoing type reference resolution, even when we had old ones we could reuse.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Mar 23, 2022
return;
}

const existingResolutions = file.resolvedTypeReferenceDirectiveNames;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want to add method that does something similar to `` instead of calling resolveTypeReferenceDirectiveNamesWorker where the resolutions are reused and call it from `tryReuseStructureFromOldProgram` as well

This change currently has two points lacking:

  1. it doesnt handle case where source files are modified and program tries to compute new module resolutions and type reference directives. (look in tryReuseStructureFromOldProgram)
  2. Doesnt report error esolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext when reusing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesnt handle case where source files are modified and program tries to compute new module resolutions and type reference directives.

tryReuseStructureFromOldProgram already overwrites resolvedTypeReferenceDirectiveNames with new resolutions when they change (and sets StructureIsReused.SafeModules rather than StructureIsReused.Completely - not that it matters here, since we have a full new resolved resolution list already made in the former case, so don't need to redo what tryReuseStructureFromOldProgram's already calculated) - we just didn't use the result here.

Doesnt report error esolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext when reusing

Done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weswigham weswigham marked this pull request as draft August 13, 2024 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Waiting on reviewers

Development

Successfully merging this pull request may close these issues.

3 participants