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

cargo upgrade -i: crates.io index growing huge and slow execution time #903

Closed
mbuesch opened this issue Aug 30, 2024 · 5 comments · Fixed by #907
Closed

cargo upgrade -i: crates.io index growing huge and slow execution time #903

mbuesch opened this issue Aug 30, 2024 · 5 comments · Fixed by #907

Comments

@mbuesch
Copy link

mbuesch commented Aug 30, 2024

When I run cargo upgrade -i it massively grows my crates.io index each time and it take a huge time (and CPU) to complete:

me:myproject$ du -sh $HOME/.cargo/registry/index/
1.9G    /[...]/.cargo/registry/index/
me:myproject$ time cargo upgrade -i
    Updating 'https://github.com/rust-lang/crates.io-index' index
[...]
real    7m21.145s
user    5m14.968s
sys     1m0.414s
me:myproject$ du -sh $HOME/.cargo/registry/index/
2.3G    /[...]/.cargo/registry/index/
me:myproject$ time cargo upgrade -i
    Updating 'https://github.com/rust-lang/crates.io-index' index
[...]
real    7m13.851s
user    5m11.708s
sys     0m54.590s
me:myproject$ du -sh $HOME/.cargo/registry/index/
2.6G    /[...]/.cargo/registry/index/

If I run git gc in the index manually, the size goes back to normal.
But if I never do gc, then it continues to grow indefinitely each time cargo upgrade -i is run.

That happens, even if the upgrade didn't really change anything or it is run immediately following a previous run (crates.io hasn't changed much in-between).

cargo upgrade -i used to be much faster in the past.

I use cargo-edit v0.12.3

@epage
Copy link
Collaborator

epage commented Aug 30, 2024

cargo upgrade -i used to be much faster in the past.

I wonder if the index isn't being squashed as often as it used to.

@mbuesch
Copy link
Author

mbuesch commented Aug 30, 2024

I noticed the growing size behavior when it was over 10G in size. I then manually gc'ed it. So I can say up to at least 10G it did not try to reduce the size by itself.

The runtime does not decrease after gc, though.

@Coekjan
Copy link

Coekjan commented Sep 7, 2024

Same issue. And I think this issue makes cargo-upgrade unusable...

@awused
Copy link

awused commented Sep 11, 2024

I noticed cargo upgrade was consistently getting slower. registry/index/github.com-1ecc6299db9ec823 before git gc was 19G (via du -h), and after a gc it was only 855MB. That seems excessive.

It didn't make a difference in execution speed and I still see it taking over a minute even when running it twice in a row on the same repo.

@mbuesch
Copy link
Author

mbuesch commented Sep 17, 2024

Thanks. The fix works.

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

Successfully merging a pull request may close this issue.

4 participants