[Chapel Merge] Cache module-level scope resolution

Branch: refs/heads/main
Revision: 733149c
Author: mppf
Link: Cache module-level scope resolution by mppf · Pull Request #19900 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19900 from mppf/cache-module-scope-resolves

Cache module-level scope resolution

PR #19306 made scope resolution significantly slower. I think part of the
reason for that is it removed some caching. This PR adds some caching for
module-level name lookups to make the process faster in the face of uses
and imports. That allows scope resolution to run slightly faster (in my
experiments) than before PR #19306.

The caching needed some adjustment in order to work with extern block
support. See also PR #12235 for history in this area.

See also

Reviewed by @lydia-duncan - thanks!