Running Shell Commands from Swift - Performance issues

I'm writing a small CI tool in Swift for building our Xcode projects so I need to invoke xcodebuild from Swift code. I use the Process class to invoke shell commands, but when invoking xcodebuild like that, the build times are extremely slow compared to just running the same command from the command line.

I'm taking about the difference of 10 mins vs 60 mins. I can also see that my CPU is not utilised very much.

Does anybody know what is going on here?

I don't know how much this will help, but in sourcekitten/jazzy we run xcodebuild using Process and do not see this type of problem -- and these tools have been extremely widely used with all kinds of setups. Code starts around here in case it gives you any ideas.

1 Like