[SR-10708] switch over Dictionary lookup retains ref count #53105
Labels
ARC
Feature: automatic reference counting
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
regression
SILOptimizer
Area → compiler: SIL optimization passes
standard library
Area: Standard library umbrella
swift 5.0
Attachment: Download
Environment
Apple Swift version 5.0 (swift-5.0-RELEASE)
Target: x86_64-apple-darwin18.5.0
Additional Detail from JIRA
md5: c994e96b09804105727b513a51ebc355
relates to:
Issue Description:
When switching over the result of a dictionary lookup directly in Swift 5 and then modifying that dictionary it will be copied.
The above code allocates 1092 times in total.
When assigning the result to a variable first, it does not copy.
The above code allocates 91 times in total.
In Swift 4.2 both versions do not copy, so this seems to be a regression in Swift 5.
The text was updated successfully, but these errors were encountered: