Skip to content

[Stdlib] Add notes to lazy collection doc comments about complexity #829

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions stdlib/public/core/Filter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ public func == <Base : CollectionType>(
/// A lazy `CollectionType` wrapper that includes the elements of an
/// underlying collection that satisfy a predicate.
///
/// - Note: The performance of advancing a `LazyFilterIndex`
/// depends on how sparsely the filtering predicate is satisfied,
/// and may not offer the usual performance given by models of
/// `ForwardIndexType`. Be aware, therefore, that general operations
/// on `LazyFilterCollection` instances may not have the
/// documented complexity.
/// - Note: The performance of accessing `startIndex`, `first`, any methods
/// that depend on `startIndex`, or of advancing a `LazyFilterIndex` depends
/// on how sparsely the filtering predicate is satisfied, and may not offer
/// the usual performance given by `CollectionType` or `ForwardIndexType`. Be
/// aware, therefore, that general operations on `LazyFilterCollection`
/// instances may not have the documented complexity.
public struct LazyFilterCollection<
Base : CollectionType
> : LazyCollectionType {
Expand Down
8 changes: 8 additions & 0 deletions stdlib/public/core/Flatten.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,14 @@ public func == <BaseElements> (
/// * `c.flatten().map(f)` maps eagerly and returns a new array
/// * `c.lazy.flatten().map(f)` maps lazily and returns a `LazyMapCollection`
///
/// - Note: The performance of accessing `startIndex`, `first`, any methods
/// that depend on `startIndex`, or of advancing a `${Collection}Index`
/// depends on how many empty subcollections are found in the base
/// collection, and may not offer the usual performance given by
/// `CollectionType` or `${traversal}IndexType`. Be aware, therefore, that
/// general operations on `${Collection}` instances may not have the
/// documented complexity.
///
/// - See also: `FlattenSequence`
public struct ${Collection}<
Base: CollectionType where ${constraints % {'Base': 'Base.'}}
Expand Down