c'mon everyone knows genetic population is 30
(I kid I kid but that number has an interesting story https://statswithcats.wordpress.com/2010/07/11/30-samples-st... )
Surprising. Swift, a compiled, static language, is slower than python in this use case?
Code without the optimiser can easily be several hundred to more than a thousand times slower than optimised code. And of course the optimiser makes compile times even slower.
It's really quite a spectacle.
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://gist.github.com/rookie/3d9a848c6fefacc4254da921da79b...
It now runs faster (when compiled, optimized) than the python code.
xcrun -sdk macosx swiftc -O gen.swiftvar n = Double(arc4random_uniform(UInt32(weightTotal * 1000000.0))) / 1000000.0
Agreed with e28eta - I actually saw RubikSwift demoed at Swift Summit a few days ago as well and enjoyed it. Definitely check it out if you're interested in the topic.
I'm gonna give it a shot
But i'm 100% certain it's going to be one of the most used language server side in the coming years.