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

Reuse archiveCompiledFiles helper for long commandline shrink #2464

Merged
merged 5 commits into from
Dec 20, 2023

Conversation

facchinm
Copy link
Member

Since archiveCompiledFiles already handles hot cache correctly, this avoids objs.a being rebuilt even if files don't change.

Would be ideal if PathList could expose a generic Filter API (to get rid of the "duplicated" filter) @cmaglie

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?

Reusing code is always a good idea, particularly if this fixes a missed optimization (the code path for long commandlines was always rebuilding objs.a even if the cache was hot)

What is the current behavior?

objs.a are always recreated in "long commandline" sketches

What is the new behavior?

Cached objs.a are reused, quite significant speedup for ArduinoIotCloud sketches

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

Other information

@cmaglie
Copy link
Member

cmaglie commented Dec 19, 2023

Great patch, it's the second code optimization that you found! 👍🏼

BTW there is still a test failing, I'm looking into that. https://github.com/arduino/arduino-cli/actions/runs/7209431432/job/19640374148?pr=2464#step:6:2717

@cmaglie cmaglie self-assigned this Dec 19, 2023
@cmaglie cmaglie added type: enhancement Proposed improvement topic: build-process Related to the sketch build process labels Dec 19, 2023
@cmaglie cmaglie force-pushed the use_cached_objs_long_commandlines branch from 434978c to 4410dc1 Compare December 19, 2023 17:50
Copy link

codecov bot commented Dec 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (71ff4ac) 67.60% compared to head (373e871) 67.65%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2464      +/-   ##
==========================================
+ Coverage   67.60%   67.65%   +0.05%     
==========================================
  Files         207      207              
  Lines       20710    20706       -4     
==========================================
+ Hits        14000    14008       +8     
+ Misses       5565     5557       -8     
+ Partials     1145     1141       -4     
Flag Coverage Δ
unit 67.65% <100.00%> (+0.05%) ⬆️

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

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

@umbynos umbynos self-requested a review December 20, 2023 08:51
@umbynos umbynos added this to the Arduino CLI v0.35.0 milestone Dec 20, 2023
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.

🚗 💨 🚀

internal/arduino/builder/linker.go Outdated Show resolved Hide resolved
facchinm and others added 5 commits December 20, 2023 10:53
Since archiveCompiledFiles already handles hot cache correctly, this avoids objs.a being rebuilt even if files don't change.

Would be ideal if PathList could expose a generic Filter API (to get rid of the "duplicated" filter)
It doesn't make sense anymore to keep path and filename separated.
@cmaglie cmaglie force-pushed the use_cached_objs_long_commandlines branch from a44fb6d to 373e871 Compare December 20, 2023 09:56
@cmaglie cmaglie merged commit 72dd249 into arduino:master Dec 20, 2023
102 checks passed
cmaglie added a commit to cmaglie/arduino-cli that referenced this pull request Dec 20, 2023
* Reuse archiveCompiledFiles helper for long commandline shrink

Since archiveCompiledFiles already handles hot cache correctly, this avoids objs.a being rebuilt even if files don't change.

Would be ideal if PathList could expose a generic Filter API (to get rid of the "duplicated" filter)

* Upgrade go-paths / remove duplicate filter function

* Consider existing archives during the build

* Simplified archiveCompiledFiles function signature

It doesn't make sense anymore to keep path and filename separated.

* Added integration test

---------

Co-authored-by: Cristian Maglie <c.maglie@arduino.cc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: build-process Related to the sketch build process type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants