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-318] LazyCollection.SubSequence.SubSequence introduces multiple levels of Slice wrapping #42940

Closed
gribozavr opened this issue Dec 19, 2015 · 2 comments
Labels
affects ABI Flag: Affects ABI bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. performance standard library Area: Standard library umbrella

Comments

@gribozavr
Copy link
Collaborator

Previous ID SR-318
Radar rdar://problem/31418206
Original Reporter @gribozavr
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, AffectsABI, Performance
Assignee None
Priority Medium

md5: 71408b048bea80cc8a69d3171d339b8b

Issue Description:

As Kevin Ballard noticed,

(swift) LazyCollection<[Int]>.SubSequence.self
// r0 : LazyCollection<Slice<[Int]>>.Type = Swift.LazyCollection<Swift.Slice<Swift.Array<Swift.Int>>>

(swift) LazyCollection<[Int]>.SubSequence.SubSequence.self
// r1 : LazyCollection<Slice<Slice<[Int]>>>.Type = Swift.LazyCollection<Swift.Slice<Swift.Slice<Swift.Array<Swift.Int>>>>

(swift) LazyCollection<[Int]>.SubSequence.SubSequence.SubSequence.self
// r2 : LazyCollection<Slice<Slice<Slice<[Int]>>>>.Type = Swift.LazyCollection<Swift.Slice<Swift.Slice<Swift.Slice<Swift.Array<Swift.Int>>>>>

Multiple levels of Slice<T> wrapping is bad not just because of the type, but because each Slice has its own index bounds stored, and every access through a Slice needs to perform a range check. So having multiple levels of wrapping would affect performance in this case.

@bob-wilson
Copy link

@swift-ci create

@DougGregor
Copy link
Member

#11769 provides consistency of slices.

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

No branches or pull requests

3 participants