---
title: Performance Hints (PerformanceHints)
framework: swift-compiler
role: article
role_heading: Article
path: swift-compiler/documentation/diagnostics/performance-hints
---

# Performance Hints (PerformanceHints)

## Overview

Overview The PerformanceHints diagnostic group provides opt-in guidance for identifying language constructs and code patterns that carry non-obvious runtime performance costs. The diagnostics are intended to help developers writing performance-critical code make informed decisions about the abstractions they use and to surface hidden costs that may not be apparent from the source code alone to a non-expert Swift programmer. This diagnostic group is off by default. It can be enabled as warnings with -Wwarning PerformanceHints, or escalated to errors with -Werror PerformanceHints. Sub-groups The PerformanceHints group contains the following sub-groups, each of which can also be enabled or controlled independently: Existential Types and Performance (ExistentialType): Warns on use of existential types (any Protocol), which incur heap allocation, reference counting, exclusivity enforcement, and dynamic dispatch overhead. Implicit Copy On Return (ReturnTypeImplicitCopy): Warns when functions or closures return Array or Dictionary values, which leads to implicit heap-allocated copies of the collections. Untyped throws (UntypedThrows): Warns on untyped throws declarations, where the use of any Error incurs a heap allocation on each throw. For example, to enable only the UntypedThrows checks as warnings: -Wwarning UntypedThrows Or to enable all performance hints as errors but keep UntypedThrows as a warning: -Werror PerformanceHints -Wwarning UntypedThrows

## See Also

- [@dynamicCallable implementation requirements (DynamicCallable)](swift-compiler/documentation/diagnostics/dynamic-callable-requirements.md)
- [Add @preconcurrency import (AddPreconcurrencyImport)](swift-compiler/documentation/diagnostics/add-preconcurrency-import.md)
- [Always enabled availability domains (AlwaysAvailableDomain)](swift-compiler/documentation/diagnostics/always-available-domain.md)
- [Argument matching for trailing closures (TrailingClosureMatching)](swift-compiler/documentation/diagnostics/trailing-closure-matching.md)
- [Calling a mutating async actor-isolated method (ActorIsolatedMutatingAsync)](swift-compiler/documentation/diagnostics/actor-isolated-mutating-async.md)
- [Calling an actor-isolated method from a synchronous nonisolated context (ActorIsolatedCall)](swift-compiler/documentation/diagnostics/actor-isolated-call.md)
- [Captures in a `@Sendable` closure (SendableClosureCaptures)](swift-compiler/documentation/diagnostics/sendable-closure-captures.md)
- [Compilation caching (CompilationCaching)](swift-compiler/documentation/diagnostics/compilation-caching.md)
- [Conforming to `StringInterpolationProtocol` (StringInterpolationConformance)](swift-compiler/documentation/diagnostics/string-interpolation-conformance.md)
- [Conversion from `@isolated(any)` function type to synchronous function type (ConversionFromIsolatedAnyToSynchronous)](swift-compiler/documentation/diagnostics/conversion-from-isolated-any-to-synchronous.md)
- [Cross-isolation data race (RegionIsolationCrossIsolationDataRace)](swift-compiler/documentation/diagnostics/region-isolation-cross-isolation-data-race.md)
- [Deprecated declaration warnings (DeprecatedDeclaration)](swift-compiler/documentation/diagnostics/deprecated-declaration.md)
- [Deprecated implementation-only imports (ImplementationOnlyDeprecated)](swift-compiler/documentation/diagnostics/implementation-only-deprecated.md)
- [Dynamic exclusivity (DynamicExclusivity)](swift-compiler/documentation/diagnostics/dynamic-exclusivity.md)
- [Embedded Swift language restrictions (EmbeddedRestrictions)](swift-compiler/documentation/diagnostics/embedded-restrictions.md)
