Cvs 1.0.0-beta-3 crate [cargo update slow?]

I was just reading "week in Rust" and wanted to try the cvs crate.

So I added the crate to the dependencies in Cargo.toml and did cargo build.
I was unprepared for what happened. More precisely, nothing happened.
It printed: Updating registry
and then the compiler appeared to enter some kind of quiet infinite loop, doing nothing.

Oh, wait, it has now done something, about ten minutes later.
Is this a normal expectation for Rust compilations?

1 Like

Yes, this specific Cargo operation is very slow.


It shouldn't take that long. It could be an issue of github, but if the issue persists, please let us know.

1 Like

It might be helped by cargo#4026 which avoids actually checking out files for the registry, instead reading them all from git objects.

Someday it might also be possible to do a shallow git clone of the registry, but this depends either on libgit2 getting this feature or manually flattening its history -- see cargo#1171.


Sorry to pick on this reply, but while technically true, it's not very helpful. The only thing one can take away from it is "Cargo is slow". It's not much more work to explain that it's actually not part of a compilation, but a git clone/pull in the Cargo registry repo, whose speed mainly depends on the user's internet connection, and that it usually only takes long the first time, or when it hasn't run for a while.


Honestly, I would like to have a go at investigating and optimizing this later on, because I think there is more to it than just user connection speed. I have had this step take ages on an otherwise very fast internet connection (1Gbps) with the average download speed hovering around tens of kB/s. So either the upstream server needs more hardware/bandwidth, or it is cargo itself which does something stupid/unoptimized here.

As of now, I currently don't know, and have no time to look into this myself at the moment, so I decided not to comment further on why I speculate that this is so slow. But it is definitely one of the few pain points of the everyday cargo user experience for me.


(since this is more about cargo than the CVS crate, I took the liberty of updating the topic title to indicate this)


The upstream server is github, so I don't think it's that :slight_smile:

Looking into the source, it looks like the equivalent of a "git fetch" using the libgit2 library. And I can confirm that an initial update via cargo takes the same time as with command-line "git clone".

But of course there might be circumstances where this is not the case...

1 Like