by nicky0 · 10y ago · 0 comments
Certainly I have found my own Swift scripts seem to be a lot slower than compiled programs.
EDIT: from my own test with 1000 iterations, script version 17s, compiled version (release build) 5.4s
https://dl.dropboxusercontent.com/u/13740348/Screen%20Shot%2...
extension Character {
var asciiValue: UInt32? {
return String(self)
.unicodeScalars
.filter{$0.isASCII}
.first?
.value
}
}
Certainly if it is optimal, but probably also if it isn't, I would change the program to not do that conversion in inner loops.https://gist.github.com/rookie/3d9a848c6fefacc4254da921da79b...