Skip to content

Instantly share code, notes, and snippets.

@andersio
Created December 12, 2016 16:59
Show Gist options
  • Select an option

  • Save andersio/6d38420deb0f1abc5dc57e85cddc3eeb to your computer and use it in GitHub Desktop.

Select an option

Save andersio/6d38420deb0f1abc5dc57e85cddc3eeb to your computer and use it in GitHub Desktop.
import XCTest
class ReplaceSubrangeTests: XCTestCase {
func testOneElementArray() {
var one = [1, 2, 3, 4, 5, 6, 7, 8]
self.measure {
for _ in 0 ..< 1000000 {
one.replaceSubrange(7 ..< 8, with: CollectionOfOne(8))
//one.append(8)
}
}
}
func testMulti() {
var one = [1, 2, 3, 4, 5, 6, 7, 8]
self.measure {
for _ in 0 ..< 1000000 {
one.replaceSubrange(7 ..< 8, with: [8])
//one.append(8)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment