Build-wrapper slows down build by %70

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
    GitHub
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI
    CircleCI
  • Scanner command used when applicable (private details masked)
> time ../sonar/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir fastlane/artifacts/sonar env NSUnbufferedIO=YES xcodebuild -scheme Scheme -project Project.xcodeproj -configuration Release COMPILER_INDEX_STORE_ENABLE=NO ONLY_ACTIVE_ARCH=YES -destination 'platform=iOS Simulator,name=iPhone 6s' clean build

real	5m19.880s
user	11m47.208s
sys	4m30.720s
> time env NSUnbufferedIO=YES xcodebuild -scheme Scheme -project Project.xcodeproj -configuration Release COMPILER_INDEX_STORE_ENABLE=NO ONLY_ACTIVE_ARCH=YES -destination 'platform=iOS Simulator,name=iPhone 6s' clean build

real	3m8.394s
user	0m4.529s
sys	0m1.693s
  • Languages of the repository
    Obj-C, C++, Obj-C++

Hi, as you can see above, our build times increase by %50 when we use build-wrapper. What could be the reason for this?

Can I ask a simple question? Why Sonarqube can not utilize a more standard compilation information such as json-compilation-database format? Does it perform some additional analysis by intercepting the build process and checking the stack trace for example?

In the end, this %70 increase is not affordable. It would be great if you could help me detect what’s the issue.

Best

Hi @manuyavuz-pointr,

in which are you running your test for Mac OS? Is it a regular slow down? Which version of Mac OS and XCode?

We are thinking about that: CPP-1428.

Is it a private or public project?

Hi @mpaladin,

CI: CircleCI
Xcode: 10.2.1
macOS: 10.14.4
Full image content: https://circle-macos-docs.s3.amazonaws.com/image-manifest/build-594/index.html

I recognized this when I was trying to optimize build time for our lint job, and see that compile time differs too much compared to my local machine which has almost the same hw specs.

After seeing the difference, I tried a CI build with ssh access, and ran above two commands when CPUs are empty. It always repeats the case.

Do you think having too many preprocessor macros would affect the performance? for each compile command, we have a few hundreds of -D_symbol=PREFIX_symbol kind of macro definitions provided. I’m not sure if it would affect build-wrapper's performance.

Project is a private project.

Hi @manuyavuz-pointr,

I created a ticket on our side to improve the situation, I found the cause of the slow down: https://jira.sonarsource.com/browse/CPP-2249.

1 Like

Hi @mpaladin,

I saw the issue as Fixed now in JIRA. How can I start to use the updated wrapper binary? Should I just re-download the binary from https://sonarcloud.io/static/cpp/build-wrapper-macosx-x86.zip link which exists here:https://sonarcloud.io/documentation/analysis/languages/cfamily/?

Thanks for quick fix!

Hi @manuyavuz-pointr,

it is going to be released this week and then it will come to SonarCloud, you will have to wait few days, cannot tell you exactly.

I hope that the fix I made fixes your slow-down case too.

Thanks @mpaladin! Is there any way to register for update notifications on Sonarcloud?

Hi @manuyavuz-pointr,

it should appear in the SonarCloud notifications panel:

Awesome!

Hi @manuyavuz-pointr,

I confirm you that it has been deployed on SonarCloud.

Hi @mpaladin,

I can confirm that this update fixed significantly slow compilation problem!

With wrapper: 1 min 48 secs
Without wrapper: 1 min 43 secs

Thanks again!

For anyone who has similar problem, the solution is to use the most recent macOS build wrapper which has version 6.4:

$ sonar/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --version
build-wrapper, version 6.4 (macosx-x86)
Copyright (C) 2014-2019 SonarSource SA, info@sonarsource.com

Usage: sonar/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir <output directory> <build command>
1 Like

Hi @manuyavuz-pointr,

thank you for reporting back, glad to hear that it fixed the slowdown.