Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: excessive CPU/Disk usage when multiple build-paths points in the sketch directory #2342

Merged
merged 4 commits into from
Sep 26, 2023

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Sep 26, 2023

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

Reduce CPU and disk consumption if multiple build paths are created in the sketch directory.

What is the current behavior?

See #2266 for details, for example running a build using the build-path to multiple subdirs of the sketch:

arduino-cli compile -b arduino:mbed_nano:nano33ble --build-cache-path build-nano33ble --build-path build-nano33ble
arduino-cli compile -b arduino:mbed_nano:nano33ble --build-cache-path build-nano33blesense2 --build-path build-nano33blesense2 --build-property 'compiler.cpp.extra_flags=-DSENSE_REV2'

results in:

  • a full sketch rebuild when the target directory is changed (unneeded CPU consumption)
  • a multiple recursive copy of the not-used build paths (unneeded disk space consumption)

What is the new behavior?

The sketch is compiled as expected:

  • without a full rebuild when the sketch is unchanged
  • without unneeded copying of the build folders

Does this PR introduce a breaking change, and is titled accordingly?

No

Other information

It's worth noting that the compiled sketch is not broken, it just takes more resources/time to compile.

Fix #2266

@cmaglie cmaglie added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Sep 26, 2023
@cmaglie cmaglie added this to the Arduino CLI 0.35.0 milestone Sep 26, 2023
@cmaglie cmaglie self-assigned this Sep 26, 2023
@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (422aa87) 63.06% compared to head (b3c561d) 63.04%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2342      +/-   ##
==========================================
- Coverage   63.06%   63.04%   -0.03%     
==========================================
  Files         201      201              
  Lines       19259    19262       +3     
==========================================
- Hits        12145    12143       -2     
- Misses       6060     6065       +5     
  Partials     1054     1054              
Flag Coverage Δ
unit 63.04% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
arduino/sketch/sketch.go 81.92% <100.00%> (-0.84%) ⬇️
commands/upload/upload.go 73.36% <100.00%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@alessio-perugini alessio-perugini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally working. 💪

@cmaglie cmaglie merged commit c004b42 into arduino:master Sep 26, 2023
93 checks passed
@cmaglie cmaglie deleted the fix_multi_buildpath_copy branch September 26, 2023 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiling for different board variants in different build-dirs does not reuse already compiled objects
2 participants