mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Make cross-importing faster
We previously computed cross-imports by comparing N transitive imports against N transitive imports. This is wasteful, because at least one of the two modules in a pair has to actually declare a cross-import overlay for us to discover one, and the vast majority of modules don’t declare any. This commit makes us instead compare N transitive imports against M transitive imports which are known to declare at least one cross-import overlay. Since N is potentailly in the thousands while M is perhaps in the double digits, this should be good for a substantial time savings. However, this optimization has made a test of another cross-import performance optimization fail—not because we have regressed on that, but because it skips work the test case expects us to perform. I have XFAILed that test for now. Fixes <rdar://problem/59538458>.
This commit is contained in:
@@ -260,6 +260,18 @@ public:
|
||||
/// Add a file declaring a cross-import overlay.
|
||||
void addCrossImportOverlayFile(StringRef file);
|
||||
|
||||
/// If this method returns \c false, the module does not declare any
|
||||
/// cross-import overlays.
|
||||
///
|
||||
/// This is a quick check you can use to bail out of expensive logic early;
|
||||
/// however, a \c true return doesn't guarantee that the module declares
|
||||
/// cross-import overlays--it only means that it \em might declare some.
|
||||
///
|
||||
/// (Specifically, this method checks if the module loader found any
|
||||
/// swiftoverlay files, but does not load the files to see if they list any
|
||||
/// overlay modules.)
|
||||
bool mightDeclareCrossImportOverlays() const;
|
||||
|
||||
/// Append to \p overlayNames the names of all modules that this module
|
||||
/// declares should be imported when \p bystanderName is imported.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user