Skip to content

Instantly share code, notes, and snippets.

Letanyan Arumugam Letanyan

View GitHub Profile
@Letanyan
Letanyan / OffsetBenchmarks.swift
Last active Apr 16, 2019
Benchmarking the performance of various ways to access a collection using an offset
View OffsetBenchmarks.swift
import Dispatch
extension BidirectionalCollection {
subscript(offset o: Int) -> Element {
if o < 0 {
return self[index(endIndex, offsetBy: o)]
} else {
return self[index(startIndex, offsetBy: o)]
}
}
You can’t perform that action at this time.