[SR-13299] Repeated.last is 20x slower than Repeated[Repeated.count - 1] #55739
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
performance
standard library
Area: Standard library umbrella
Attachment: Download
Environment
macOS 10.15.6 (19G73)
Xcode 11.6 (11E708)
Additional Detail from JIRA
md5: 28253a2932c8b4a653b19ea302f51063
Issue Description:
I suppose the cost of accessing the last element from a
Repeated
collection should be the same whether I usedRepeated.last
orRepeated[Repeated.count - 1]
.But this quick test reveals that
Repeated.last
is 20x slower thanRepeated[Repeated.count - 1]
for no obvious reason.The text was updated successfully, but these errors were encountered: