Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will Xcode compile more Swift files in parallel if you have more cpu cores?

Tags:

xcode

swift

When building a project, I can see Xcode working on 4 Swift files at the same time in the Build Log inside the report navigator.

I also see that there are 4 processes in Activity Manager, all called "Swift", when it's compiling.

It seems to be doing a great use of the available processing power to do it's job, so I'm not looking to change that. However, i'm working with a Dual Core i7 processor.

Would a Quad Core i7 be able to compile 8 files in parallel? And if so, would it also scale up if it were 6 cores?

Could someone with at least a Quad Core do a test to confirm this?

I'm using Xcode 6.3.1

Thank you!

like image 609
nmdias Avatar asked Apr 28 '15 07:04

nmdias


2 Answers

This is the CPU Usage on my MacBook Pro with the Apple M1 Pro during the normal thinking-typing-thinking-typing work that takes up 99% of my work day. The two cores on the left are the efficiency cores and the 8 on the right are the performance cores. It spends most of its time just like that. And there are a dozen apps open.

enter image description here

And when it’s time to see if that thinking-typing amounted to anything it’s nice to see all 10 cores max out while the app builds. That’s cool.

enter image description here

like image 117
Murray Sagal Avatar answered Oct 01 '22 07:10

Murray Sagal


Xcode will use as many available processors as it can. There are some situations where it cannot use all processors, for example it cannot compile Objective-C files until all precompiled header files are compiled, so if you have one precompiled header file only, then only one processor will be used for that. But for all your normal source files, all the processors will be used. And for the static analyzer, all the processors will be used as well.

In other words, the quad core Retina MBP 15" is a very fine development machine. Give it lots of RAM if you have large source files, I had problems with 8 core MacPro with 4GB of RAM (long time ago). An older Mac Mini with four cores is also quite useful.

like image 45
gnasher729 Avatar answered Oct 01 '22 07:10

gnasher729