Re: memmove in Swift
Re: memmove in Swift
- Subject: Re: memmove in Swift
- From: Roland King <email@hidden>
- Date: Thu, 21 Aug 2014 23:28:40 +0800
>>
>> What is [UInt32] for ObjC? A C-array of uint32_t?
>
> Well, the OBj-C sort gets a Swift array and treats it as as a C-array of UInt32. Same as the Swift version.
>
I think that counts as comparing Swift to C. Perhaps Swift Arrays with a generic of uint32_t should in fact optimize down to the same routine written in C for sorting uint32_t's or hand-tuned assembler, but that seems a little optimistic. I'd say both this and the Swift Array <--> NSArray test are valid, the latter is more a real-world case, unless you in fact use C arrays all over your current Cocoa code, most people don't.
>>> 2. the build-in Swift function sorted(array) crashes with an array of size 10 million and values in the range 0 ... 100. Probably due to excessive recursion.
>>> 3. the build-in Swift function sorted(array) with an array of size 10 million and values in the range 0 ... 1000 is about 100 times slower than my own quickSort.
>>>
>>
>> 2) bad, I think I read something on the dev forums about sorted() running out of stack space but I thought that was when run on a thread.
>>
>> 3) Not brilliant either - what optimization flags were you using for all this?
>
> The default release ones: ObjC: Fastest, Smallest and Swift: Fastest.
Isn't there an 'unchecked' option somewhere, or is that still aliased to Fastest?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden