Created
April 26, 2015 12:26
-
-
Save mzaks/4ffa2cb8ece7c94f3a73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func measureList(){ | |
let time = NSDate() | |
var a = 0 => nil | |
for i in 1...1_000{ | |
a = i => a | |
} | |
let after = NSDate() | |
println("\(after.timeIntervalSince1970 - time.timeIntervalSince1970) List 1K") | |
} | |
func measureEList(){ | |
let time = NSDate() | |
var a = EList<Int>.Nil | |
for i in 1...1_000{ | |
a.prepand(i) | |
} | |
let after = NSDate() | |
println("\(after.timeIntervalSince1970 - time.timeIntervalSince1970) EList 1K") | |
} | |
func measureClasList(){ | |
let time = NSDate() | |
var a = CList<Int>(0) | |
for i in 1...1_000{ | |
a.prepand(i) | |
} | |
let after = NSDate() | |
println("\(after.timeIntervalSince1970 - time.timeIntervalSince1970) ClassList 1K") | |
} | |
measureList() // 0.309807062149048 List 1K | |
measureEList() // 0.000725269317626953 EList 1K | |
measureClasList() // 0.000340938568115234 ClassList 1K |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment