Skip to content

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

@mbuesch

Description

@mbuesch

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions