Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-428] Implement new performance terminology in documentation #43045

Open
dabrahams opened this issue Dec 31, 2015 · 0 comments
Open

[SR-428] Implement new performance terminology in documentation #43045

dabrahams opened this issue Dec 31, 2015 · 0 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. documentation standard library Area: Standard library umbrella

Comments

@dabrahams
Copy link
Contributor

Previous ID SR-428
Radar rdar://19751259
Original Reporter @dabrahams
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, Documentation
Assignee @natecook1000
Priority Medium

md5: 27e2fe8cb32c5f7fdcb7599c3d36bbcb

is duplicated by:

  • SR-425 Indexable documents startIndex as O(1) but this isn't true for some lazy collections

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:

  1. Document what are currently complexity requirements on protocols as “Expected complexity:”

  2. Document what are currently complexity guarantees as “Complexity:”

  3. Make a blanket statement is that components may fail to deliver documented complexity if any of their arguments fail to deliver the expected complexity.

  4. 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

  5. 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).

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. documentation standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

1 participant