mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Runtime: use SmallVector instead of std::vector to avoid memory allocations in most cases.
This dramatically reduces the number of needed malloc calls. Unfortunately I had to add the implementation of SmallVectorBase::grow_pod to the runtime, as we don't link LLVM. This is a bad hack, but better than re-inventing a new SmallVector implementation. SR-10028 rdar://problem/48575729
This commit is contained in:
@@ -162,7 +162,7 @@ template<>
|
||||
const WitnessTable *
|
||||
ProtocolConformanceDescriptor::getWitnessTable(const Metadata *type) const {
|
||||
// If needed, check the conditional requirements.
|
||||
std::vector<const void *> conditionalArgs;
|
||||
SmallVector<const void *, 8> conditionalArgs;
|
||||
if (hasConditionalRequirements()) {
|
||||
SubstGenericParametersFromMetadata substitutions(type);
|
||||
bool failed =
|
||||
@@ -626,7 +626,7 @@ swift::_searchConformancesByMangledTypeName(Demangle::NodePointer node) {
|
||||
|
||||
bool swift::_checkGenericRequirements(
|
||||
llvm::ArrayRef<GenericRequirementDescriptor> requirements,
|
||||
std::vector<const void *> &extraArguments,
|
||||
SmallVectorImpl<const void *> &extraArguments,
|
||||
SubstGenericParameterFn substGenericParam,
|
||||
SubstDependentWitnessTableFn substWitnessTable) {
|
||||
for (const auto &req : requirements) {
|
||||
|
||||
Reference in New Issue
Block a user