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

pkgx adds 300ms+ to each invocation of a tool #1033

Open
alecthomas opened this issue Sep 7, 2024 · 6 comments
Open

pkgx adds 300ms+ to each invocation of a tool #1033

alecthomas opened this issue Sep 7, 2024 · 6 comments

Comments

@alecthomas
Copy link

This doesn't matter much for some tools, but for others that are invoked a lot such as eg. C compilers in a large build, or protoc+plugins with a large number of .proto files, this can really add up.

I'm not sure where this time is spent, perhaps it's Deno bootstrap overhead?

~ $ time go version             
go version go1.23.0 darwin/arm64
go version  0.00s user 0.00s system 74% cpu 0.012 total
~ $ time pkgx [email protected] version
go version go1.23.0 darwin/arm64
pkgx [email protected] version  0.20s user 0.06s system 78% cpu 0.341 total
~ $ time ~/.local/bin/go version
go version go1.23.0 darwin/arm64
~/.local/bin/go version  0.17s user 0.06s system 51% cpu 0.438 total
@mxcl
Copy link
Member

mxcl commented Sep 7, 2024

Should be fixed in the just released v1.2.0. If you get a chance please take a look and let us know. You will need to do a single --sync before the new cache is available.

@alecthomas
Copy link
Author

alecthomas commented Sep 8, 2024

Thanks, I gave it a shot but it seems to be roughly the same:

🐚 ~ $ pkgx --version                             
pkgx 1.2.0
🐚 ~ $ pkgx --sync                                

🐚 ~ $ time pkgx [email protected] version                
go version go1.23.0 darwin/arm64
pkgx [email protected] version  0.18s user 0.10s system 75% cpu 0.377 total
🐚 ~ $ time pkgx [email protected] version                
go version go1.23.0 darwin/arm64
pkgx [email protected] version  0.18s user 0.10s system 74% cpu 0.366 total
🐚 ~ $ time pkgx [email protected] version                
go version go1.23.0 darwin/arm64
pkgx [email protected] version  0.18s user 0.10s system 74% cpu 0.372 total

@mxcl
Copy link
Member

mxcl commented Sep 8, 2024

Hmm the cache cannot be working since for me eg:

$ time pkgx go version
go version go1.22.2 darwin/arm64

real	0m0.076s
user	0m0.053s
sys	0m0.018s

$ time ~/.pkgx/go.dev/v\*/bin/go version
go version go1.22.2 darwin/arm64

real	0m0.014s
user	0m0.005s
sys	0m0.007s

So still slower but not nearly as slow as before:

$ time ~/.pkgx/pkgx.sh/v1.1/bin/pkgx go version
go version go1.22.2 darwin/arm64

real	0m0.269s
user	0m0.198s
sys	0m0.042s

Note, I ran all a few times before posting these.

When you do pkgx --sync does it say caching during the output?

@alecthomas
Copy link
Author

When not pinning the version I get a similar result to you:

🐚 ~ $ time pkgx go version
go version go1.23.0 darwin/arm64
pkgx go version  0.04s user 0.01s system 63% cpu 0.086 total

@mxcl
Copy link
Member

mxcl commented Sep 9, 2024

k can reproduce, this shouldn't be the case I'll figure it out.

@alecthomas
Copy link
Author

🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants