-
Notifications
You must be signed in to change notification settings - Fork 20
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
Count installed Scoop packages if available #107
Conversation
Lovely stuff... but I'm sure there's a directory whose entries we can count, right? |
Well... yes I think we could, but I don't know how to determine the correct path to Scoop itself. The default path is under |
Okay, how are the benchmarks looking? |
I tried to run the following benchmarks on my machine:
|
Thanks for the detail stats. I can't help but notice that something is very off with these numbers, last time (a little too long ago) we benchmarked macchina, it didn't even exceed 10ms on Windows, but now it's hitting 60ms?... Are you benchmarking |
Oh no, I just realized a mistake I made: even though I remembered to build Measure-Command { .\target\debug\macchina.exe } Can you spot my mistake? I ran the tests again with the correct binary and now the results look very bad for my PR:
I totally agree that this is not acceptable and I will have to find a way to determine the installation path of Scoop and do the directory enumeration. |
50072d3
to
3cc3afa
Compare
I tried to do it that way now: I'm looking for The numbers look much better now, however there is still some impact (especially if the command for
|
Measure-Command { .\target*debug*\macchina.exe } Yep. The tests still show higher numbers than what is expected, can you please try benchmarking but with hyperfine instead? That's what we use for all our benchmarks. If the scoop command can't be found, then it's safe to assume that no such tool exists, as anyone using scoop will most definitely add it to their PATH. |
3cc3afa
to
f821660
Compare
I measured it again with hyperfine and got these results:
I'm running an Intel® Core™ i7-4770 CPU @ 3.40GHz so it's not the fastest machine. |
f821660
to
1d229fd
Compare
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.
Looks great, thanks for adding this ❤️
Sorry for bumping a merged thread, but a few days ago I wanted to add Scoop readout to macchina but couldn't get to it. Glad to see it's landed :)
How much cost does this dependency incur? I think we don't need it.
The environment variable If this variable is unset, Scoop defaults to So if we can check this variable, we can slightly speed things up (I'm assuming an env var lookup is cheaper than searching for an executable in the PATH using a |
Thank you so much @rashil2000 for this valuable info ❤️
Absolutely, which (no pun intended) is why @FantasyTeddy care to rewrite it? |
I was looking at this too, but as far as I understand (and I could be totally wrong here) the |
If you see the PowerShell command there: [Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User') this commands sets environment variables permanently (as opposed to just the current shell session, like on unix). |
Ah that's the piece of information that was missing for me. Thank you very much for enlightening me :) |
This change adds support for the Scoop installer on Windows.
It works by querying the
scoop export
command that lists all the installed packages and we can count the number of lines.