[SR-428] Implement new performance terminology in documentation #43045
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
documentation
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: 27e2fe8cb32c5f7fdcb7599c3d36bbcb
is duplicated by:
Issue Description:
Today Swift documentation of algorithmic complexity is in terms of guarantees and requirements. We want to change this, allowing algorithms to be used with data structures that violate current complexity requirements, but otherwise conform semantically to algorithm requirements. This is in no small part motivated by the fact that NSArray makes no performance requirements on its subclass, and we will happily bridge an NSArray with O(N) objectAtIndex into a Swift Array, which conforms to Collection and thus is required to be indexable in O(1).
The plan:
Document what are currently complexity requirements on protocols as “Expected complexity:”
Document what are currently complexity guarantees as “Complexity:”
Make a blanket statement is that components may fail to deliver documented complexity if any of their arguments fail to deliver the expected complexity.
Make a blanket statement that unless otherwise specified, types provided by the standard library provide the expected complexity of the protocols to which they conform
Document specific exceptions for types such as Array, Set, Dictionary, and String, explaining the conditions under which they fail to deliver expected complexity (e.g. when the backing store is an NSArray subclass with unusual performance characteristics).
The text was updated successfully, but these errors were encountered: