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

feat: move to cargo-xwin for clippy #3600

Merged
merged 7 commits into from
May 17, 2024
Merged

Conversation

samypr100
Copy link
Collaborator

@samypr100 samypr100 commented May 15, 2024

Summary

Move to cargo-xwin for clippy

Closes #3507

@messense
Copy link
Contributor

messense commented May 15, 2024

FYI, consider install cargo-xwin from pypi or github releases to avoid compiling it. And you should try to cache Windows SDK download by explicitly setting XWIN_CACHE_DIR and cache it via the cache action.

@charliermarsh
Copy link
Member

Would cargo-binstall work or no?

@messense
Copy link
Contributor

probably works, I never tried.

@messense
Copy link
Contributor

BTW, I think you forgot to use a Linux runner? otherwise using cargo-xwin on Windows isn't beneficial?

@samypr100
Copy link
Collaborator Author

samypr100 commented May 15, 2024

Indeed, was trying to gather some baseline data on windows first 😅; numbers don't look too promising thus far.

Copy link

codspeed-hq bot commented May 15, 2024

CodSpeed Performance Report

Merging #3600 will not alter performance

Comparing samypr100:cargo-xwin-clippy (aa61db7) with main (ed91b1d)

Summary

✅ 12 untouched benchmarks

@konstin
Copy link
Member

konstin commented May 15, 2024

The clippy step is 12:30min while clippy itself takes 30s, do you know where the other 12min are? The xwin download and unpack are <2min on my machine.

@samypr100 samypr100 marked this pull request as ready for review May 15, 2024 13:24
@messense
Copy link
Contributor

do you know where the other 12min are?

Probably because the network connection from GH action to Windows SDK download isn't very good, cached version is much better.

@konstin konstin added the internal A refactor or improvement that is not user-facing label May 15, 2024
Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

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

Clippy itself takes 30s, the whole job 1:30min, great work!

@samypr100
Copy link
Collaborator Author

samypr100 commented May 15, 2024

😅 need to add up the totals numbers and make a table, will do later today to get better comparison.

At a glance on an unchached run it's marginally worse by a quite the factor (2m-3m before vs 15 min now) ~ .
On cached runs job totals are actually about the same on both windows and linux.

TL;DR Seems when cache is busted the impact is much worse than it is now and we're not gaining on job total speeds.

(will also explore some other fine tuning later like separating the windows sdk cache out)

@konstin
Copy link
Member

konstin commented May 15, 2024

Would moving the xwin cache into a separate cache step only keyed on rust-toolchain.toml help? This way the cache would only ever be invalidated when we upgrade rust

@samypr100
Copy link
Collaborator Author

Would moving the xwin cache into a separate cache step only keyed on rust-toolchain.toml help? This way the cache would only ever be invalidated when we upgrade rust

You read my mind 😆

@zanieb
Copy link
Member

zanieb commented May 15, 2024

We do frequently fill our cache, we'll want to be careful that it's not evicted often due to space limitations.

@samypr100
Copy link
Collaborator Author

samypr100 commented May 16, 2024

Here's some of the initial numbers to compare I've grabbing from all the past runs.

Current Main Before Cache (Step, Job) After Cache (Step, Job)
Clippy on Windows 2m~, 3m~ 30s~, 1.25m~
New Clippy Runs After (Step, Job)
xwin on windows 2m 45s~, 5m~
xwin on linux (no cache) 14m~, 15m~
xwin on linux (rust cache) 12m~, 13m~
xwin on linux (xwin cache) 2m~, 3m~
xwin on linux (rust + xwin cache) 30s~, 1.25m~

It seems clippy xwin runs about the same speed as windows currently (post the ReFS move). The job totals are aligned on best scenarios.

The xwin cache made the biggest difference for cargo xwin, making it run consistently with current windows runner, but it introduces a bigger risk when that cache gets busted.

The 15 minute hit will be most noticeable on downstream forks (where there is no cache often) or when cache is lost in main after rust toolchain upgrades or cache eviction.

@konstin
Copy link
Member

konstin commented May 16, 2024

Personally, i think this still is a noticeable improvement, it means we skip the virtual disk setup and have a windows runner less; the 15min cache priming about every 6 weeks are acceptable.

uses: actions/cache@v4
with:
path: "${{ github.workspace}}/.xwin"
key: cargo-xwin-${{ hashFiles('rust-toolchain.toml') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think xwin cache needs to be keyed by Rust version, it's just an unpacked Windows SDK, no Rust involved.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, moved cache key to be just cargo-xwin

@samypr100 samypr100 changed the title feat: explore cargo-xwin for clippy feat: move to cargo-xwin for clippy May 17, 2024
@samypr100
Copy link
Collaborator Author

samypr100 commented May 17, 2024

Personally, i think this still is a noticeable improvement, it means we skip the virtual disk setup and have a windows runner less; the 15min cache priming about every 6 weeks are acceptable.

Sounds good, PR is good to go now. Apologies, I thought I had this PR was in draft all this time 😅

@zanieb zanieb merged commit d88bef9 into astral-sh:main May 17, 2024
44 checks passed
@samypr100 samypr100 deleted the cargo-xwin-clippy branch May 17, 2024 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal A refactor or improvement that is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explore cargo-xwin for windows CI
5 participants