GetModIfaceFromDisk has bad first call complexity #2304
Labels
performance
Issues about memory consumption, responsiveness, etc.
type: enhancement
New feature or request
The current implementation of
GetModIface
is O(# of transitive import statements), i.e. it does an amount of work proportional to the number of imports in the project. To see why, notice that to evaluateGetModIface M
, that is to load the interface for a module M, we first need to load the interfaces of all its DD direct imports, which involves DD recursive calls toGetModIface
. Transitively, this makes oneGetModIface M
call for every import in the module graph ofM
. This leads to bad startup performance in projects with a dense module graph since:Once
GetModIface M
has been called at least once the ongoing cost is O(direct imports), thanks to early cutoff, which is very good.How can we improve the bad performance of the first call while preserving the good performance of the second call?
The text was updated successfully, but these errors were encountered: