Post

Replies

Boosts

Views

Activity

Reply to possible bug in the for _ in 1...N idiom
changing the for-loop to a while-loop brings execution speed down from 13s to 0.4s import Foundation let start = CFAbsoluteTimeGetCurrent() var t = 0 for _ in 1...10000000 { // 10 mio iterations t += 1 } print(t) print(CFAbsoluteTimeGetCurrent() - start) // 13.17 seconds please see more details here https://stackoverflow.com/questions/63852086/swift-100-times-slower-than-c-in-simple-program
Sep ’20
Reply to possible bug in the for _ in 1...N idiom
@Claude31 please if you may provide this as an answer on stackoverflow, you might want to request a reopening first though. i think the attitude on stackoverflow may benefit from this. benefit in the sense that people relax their prejudice as to posters intent, and in the sense that posters stay willing to post questions of this type. although the change it will make is close to nil, have to keep trying i guess. thanks for your testing.
Sep ’20