Menu ▾ ▴

#571 Ota.TryFindPathToFile builds the whole list of folders again for every file it looks for

New
open
nobody
None
7 hours ago
7 hours ago
No

Every call of Ota.TryFindPathToFile (and so of Ota.FindPathToFile and Ota.OpenFileFromPath) calls Ota.GetAllPossiblePaths, which every time:

  • reads the project's search path and the library path,
  • reads the list of the project's units,
  • scans every folder under the IDE's Source folder recursively with a TFileFindThread, waiting for it with Sleep(1),
  • with the fix for bug #553, also checks every folder of the browsing path for existence.

An absolute file name is only recognised after all of this, in GX_GenericUtils.TryFindPathToFile, which then does not use the list.

The Uses Clause Manager calls it twice in a row, once for '.pas' and once for '.dcu', for each unit selected on the Search Path tab whose file name it has not looked up before (GX_UsesExpert.pas). There is a TODO in AddVCLPaths about caching the folders under Source.

How long one call takes has not been measured.

Possible fixes: check for an absolute file name first; build the list once for both lookups; cache the folders under Source.

Found while reviewing the fix for bug #553.

Related

Bugs: #553

Discussion


Log in to post a comment.