• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: memmove in Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memmove in Swift


  • Subject: Re: memmove in Swift
  • From: Roland King <email@hidden>
  • Date: Thu, 21 Aug 2014 17:55:44 +0800

> As it turns out he compared Obj-C using NSMutableArrays with Swift using [Int]. Not really comparing Apples with Apples.

I don't think that's so unfair. The language array type in Objective C, well Cocoa if we're being pedantic, is NSArray, that's what people writing in ObjC on one of the Apple platforms would commonly use for an array. The native array type in Swift is [Type] which is what someone writing in Swift would commonly use. So comparing those two things is valid, it's not the only test you can do, but it's a valid one. For a start it shows how generics helps, no tedious unwrapping, trying to figure out if two objects are the same type or not and then sorting them via dynamic calls, you just compare the integers.

> My test (using [UInt32] for both Swift and ObjC) showed:

What is [UInt32] for ObjC? A C-array of uint32_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?


_______________________________________________

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


  • Follow-Ups:
    • Re: memmove in Swift
      • From: "Gerriet M. Denkmann" <email@hidden>
References: 
 >memmove in Swift (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: memmove in Swift (From: Marco S Hyman <email@hidden>)
 >Re: memmove in Swift (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: memmove in Swift
  • Next by Date: Re: Good way to have default relationship to override nil?
  • Previous by thread: Re: memmove in Swift
  • Next by thread: Re: memmove in Swift
  • Index(es):
    • Date
    • Thread