[SR-5258] Mutating a dictionary's value through Dictionary.Values still leads to copying #47833
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
performance
standard library
Area: Standard library umbrella
Environment
Apple Swift version 4.0 (swiftlang-900.0.43 clang-900.0.22.8)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: 220947852a5790211c5a2c1347785438
Issue Description:
As I understand it, one of the motivations behind SE-0154 (https://github.com/apple/swift-evolution/blob/master/proposals/0154-dictionary-key-and-value-collections.md) was to eliminate the unnecessary copying of a dictionary's value upon mutating it.
However this still appears to be the case:
Looks like both the Dictionary and Dictionary.Values instances have a view onto the underlying buffer, therefore triggering a copy upon the subscript accessor being called.
The text was updated successfully, but these errors were encountered: