-
Notifications
You must be signed in to change notification settings - Fork 379
chore(cli): improve how we handle duplicate channel addition #4832
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
base: main
Are you sure you want to change the base?
chore(cli): improve how we handle duplicate channel addition #4832
Conversation
Hofer-Julian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, the command becomes noticably slower on my machine:
nu ❯ hyperfine "pixid workspace channel add https://prefix.dev/conda-forge" "pixi workspace channel add https://prefix.dev/conda-forge"
Benchmark 1: pixid workspace channel add https://prefix.dev/conda-forge
Time (mean ± σ): 790.4 ms ± 14.5 ms [User: 789.8 ms, System: 60.2 ms]
Range (min … max): 772.1 ms … 821.9 ms 10 runs
Benchmark 2: pixi workspace channel add https://prefix.dev/conda-forge
Time (mean ± σ): 78.8 ms ± 0.9 ms [User: 62.6 ms, System: 59.4 ms]
Range (min … max): 76.5 ms … 81.0 ms 37 runs
Summary
pixi workspace channel add https://prefix.dev/conda-forge ran
10.03 ± 0.21 times faster than pixid workspace channel add https://prefix.dev/conda-forge
|
Just to double check - was pixid built in --release? It is a very strange slowdown. I will need to profile it. |
|
Sorry, that was indeed the reason 🙈 It's only marginally slower now: |
Hofer-Julian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one small comment, apart from that it looks good! Thanks Nichita!
| #[derive(strum::Display, strum::EnumString)] | ||
| enum ReportOperation { | ||
| #[strum(to_string = "Added")] | ||
| Add, | ||
| #[strum(to_string = "Removed")] | ||
| Remove, | ||
| #[strum(to_string = "already exists")] | ||
| AlreadyExists, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like, this would be clearer without strum and by just adding the text to operation_text.
Overview
Running
workspace channel add already-existing-channel-in-manifest, will always print that the channel is added, even if it was already there.This change a little bit the UX ( and add a ReportOperation enum so we know for sure
whatwe want to report.)