Last active
September 22, 2016 21:31
-
-
Save viktor-evdokimov/df72a94327d12a67fe65e5989f9dcc53 to your computer and use it in GitHub Desktop.
time pre/post in swift
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
var ints: [String] = [] | |
for i in 0...10000 { | |
ints.append(String(i)) | |
} | |
var str = "start " + ints.joined(separator:" ") | |
print(str) |
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
$ ./time-it.sh | |
real 0m0.091s | |
user 0m0.060s | |
sys 0m0.024s | |
real 0m0.080s | |
user 0m0.048s | |
sys 0m0.018s | |
real 0m0.083s | |
user 0m0.062s | |
sys 0m0.018s |
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
var str = "start" | |
var i = 0; | |
for i in 0...10000 { | |
str.append(" " + String(i)) | |
} | |
print(str) |
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
var str = "start" | |
var i = 0; | |
for i in 0...10000 { | |
str = str + " " + String(i) | |
} | |
print(str) |
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
var str = "start" | |
var i = 0; | |
for i in 0...10000 { | |
str = String(i) + " " + str | |
} | |
print(str) |
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
time swift pre.swift > NUL | |
time swift post.swift > NUL | |
time swift join.swift > NUL | |
time swift post-mut.swift > NUL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment