what is nice is to report a possible bug / strange behaviour where supposedly attention to it should be appreciated, for the benefit of all
Post
Replies
Boosts
Views
Activity
at any rate, this does not require answers nor attention from people on stackoverflow, that much is sure. only, just maybe, possibly, it requires action by actual apple developers. you are very welcome.
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
this was build as a standard command line tool, no playground involved. run on a mac. please see post in stackoverflow, since every effort was already made there to explain this as succinct as possible, with all system and settings info provided, also different tests, mine and those of other people.
this is not me asking for help: in benefit of the general community, i have done my due duty reporting what i have seen, after having tested to the best of my ability within a limited time available.
@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.