Speed up Swift compile via Command Line

My app needs to compile an Xcode project (that is written BY the app) in order to extract any compile error message. It does this 3x (has to do how errors appear).

My test case is a 60k line file, and it takes 4 minutes to compile it each time (12 min total)

Can anyone come up with some modifications to these command lines that might increase the speed?

switch compile {
		case 0 : cmd  = "/usr/bin/xcodebuild -arch \"x86_64\" -project \"\(path)\""
		case 1 : cmd  = "/usr/bin/xcodebuild -arch \"arm64\"  -project \"\(path)\""
		case 2 : cmd  = "/usr/bin/xcodebuild -arch \"x86_64\"  -arch \"arm64\" -project \"\(path)\""
		default : break
	}

0 is Intel, 1 is “M1” 2 is both, currently I’m using just #1

well

  1. how much delay is there JUST starting Xcode build ? here its about 20 seconds before it even starts (no idea why)
  2. is it doing “testing” ? maybe add -skip-testing
  3. maybe run lots of jobs (see -jobs) as part of the build
  4. there are a few “skip” items ( see -skipPackagePluginValidation, -skipMacroValidation, -skipPackageSignatureValidation )

and then there are the Unix commands to give a process higher priority (see renice) but they’ll require the pid of the build to have any effect

#1 - hard to tell as it is all SHELL command

#2 - “skip-testing” requires the name of what to skip. Tried “-only-testing:dummy” assuming it would skip all as “dummy” didn’t exist. It compiled, but took same amount of time

haven’t tried #3 or #4 yet

they were just guesses
I dont have any more of them