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-13299] Repeated.last is 20x slower than Repeated[Repeated.count - 1] #55739

Open
swift-ci opened this issue Jul 26, 2020 · 0 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. performance standard library Area: Standard library umbrella

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-13299
Radar None
Original Reporter mhdhejazi (JIRA User)
Type Bug

Attachment: Download

Environment

macOS 10.15.6 (19G73)

Xcode 11.6 (11E708)

Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee None
Priority Medium

md5: 28253a2932c8b4a653b19ea302f51063

Issue Description:

I suppose the cost of accessing the last element from a Repeated collection should be the same whether I used Repeated.last or Repeated[Repeated.count - 1].

But this quick test reveals that Repeated.last is 20x slower than Repeated[Repeated.count - 1] for no obvious reason.

@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. performance standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants