Skip to content

Commit bab127f

Browse files
committed
[GSB] Put archetype anchor consistency checking behind a separate #define.
Put the archetype anchor consistency checking behind a separate it is really expensive: turning this checking off shaves 5s off the type-checking time of the standard library in my Release+Asserts build (~23% speedup).
1 parent 35c67f6 commit bab127f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
using namespace swift;
4242
using llvm::DenseMap;
4343

44+
/// Define this to 1 to enable expensive assertions.
45+
#define SWIFT_GSB_EXPENSIVE_ASSERTIONS 0
46+
4447
namespace {
4548
typedef GenericSignatureBuilder::RequirementSource RequirementSource;
4649
typedef GenericSignatureBuilder::FloatingRequirementSource
@@ -1526,7 +1529,7 @@ PotentialArchetype *PotentialArchetype::getArchetypeAnchor(
15261529
anchor = pa;
15271530
}
15281531

1529-
#ifndef NDEBUG
1532+
#if SWIFT_GSB_EXPENSIVE_ASSERTIONS
15301533
// Make sure that we did, in fact, get one that is better than all others.
15311534
for (auto pa : anchor->getEquivalenceClassMembers()) {
15321535
assert((pa == anchor || compareDependentTypes(&anchor, &pa) < 0) &&

0 commit comments

Comments
 (0)