6

I create new project with single view application and Run on device (iPhone 5s)

Product > Clean and Product > Run

Using Swift it takes 76 seconds

Using ObjC it takes 12 seconds

What's wrong with Swift or my computer ?

saranpol
  • 2,177
  • 1
  • 23
  • 22

1 Answers1

0

Swift is a new language with a new compiler that has yet to optimized to the amount that Objective-C has since Objective-C has been around for many years.

Swift's compiler is also doing a lot more than Objective-C's compiler considering Swift is more strongly typed and does not required specifying imports (among other things).

Still, 76 seconds is a long time so either your computer is underpowered or you are low on resources for some reason.

drewag
  • 93,393
  • 28
  • 139
  • 128
  • How long does swift single view application clean and run on device on your computer ? – saranpol Dec 19 '14 at 16:46
  • @saranpol 8.5 seconds. But I am on a 4 GHz i7 Retina iMac with 32 GB of RAM. – drewag Dec 19 '14 at 16:52
  • I am on 2.9 GHz i5 8 GB of RAM, but I don't think it should take up to 76 seconds, maybe try to remove xcode or clean up something – saranpol Dec 19 '14 at 17:29
  • @saranpol Check with Activity monitor and ensure you have a decent amount of free RAM and that your CPU isn't being used significantly by other processes. Also make sure you have plenty of free hard disk space. From an absolutely new project it takes me 10 seconds from requesting it to run to it running on my device. – drewag Dec 19 '14 at 17:33
  • @saranpol running on a device has always been a time consuming thing. I personally do everything possible on the simulator until I want to do usability testing. – drewag Dec 19 '14 at 17:35
  • I think swift take process copying swift standard libraries too long on device but simulator fast, ps. I clean up all xcode cache ~/Library/Developer/Xcode/DerivedData/ ~/Library/Caches/com.apple.dt.Xcode reinstall Xcode and run on device still take 76 seconds but ObjC take 12 seconds (same result) – saranpol Dec 19 '14 at 18:11