Commit graph

4358 commits

Author SHA1 Message Date
bors 263548d978 Auto merge of #4146 - alexcrichton:bump, r=alexcrichton
Bump to 0.21.0

We're working on the next version now!
2017-06-08 16:19:04 +00:00
Alex Crichton 90299a66f2 Bump to 0.21.0
We're working on the next version now!
2017-06-08 09:08:01 -07:00
bors e810012e9b Auto merge of #4145 - rust-lang:matklad-patch-1, r=alexcrichton
Fix flaky test

closes #4144.
2017-06-08 14:54:36 +00:00
Aleksey Kladov 42c83031d7 Fix flaky test 2017-06-08 17:41:31 +03:00
bors 4a79a470a8 Auto merge of #4141 - Keruspe:master, r=alexcrichton
update git2

Fixes build with libressl
2017-06-07 19:40:14 +00:00
Marc-Antoine Perennou f407bc838f update git2
Fixes build with libressl

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2017-06-07 21:35:27 +02:00
bors 88071662eb Auto merge of #4139 - Keruspe:master, r=alexcrichton
Include rustc version in metadata

Followup to #4134
Fixes https://github.com/rust-lang/rust/issues/42483
2017-06-07 18:06:32 +00:00
bors 8ec10dcb8c Auto merge of #4137 - tshepang:immutable, r=alexcrichton
binding does not need to be mutable
2017-06-07 17:31:32 +00:00
bors 678423217d Auto merge of #4062 - huntiep:master, r=alexcrichton
Load local git name/email for cargo init

Fixes #3920
2017-06-07 16:37:40 +00:00
Marc-Antoine Perennou fee7c68e59 Include rustc version in metadata
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2017-06-07 17:53:44 +02:00
bors ceb23c46f9 Auto merge of #4138 - alexcrichton:fix-tests, r=alexcrichton
Fix tests on beta

Had a few usages of `-Z` leak out of the nightly channel.
2017-06-07 15:42:07 +00:00
Alex Crichton dd7a713b73 Fix tests on beta
Had a few usages of `-Z` leak out of the nightly channel.
2017-06-07 08:37:50 -07:00
Tshepang Lekhonkhobe bd8b8668b2 binding does not need to be mutable 2017-06-07 17:23:36 +02:00
Hunter Praska fe5a875efd
Add test for local gitconf 2017-06-06 19:24:00 -05:00
bors bbfe9b3a9d Auto merge of #4126 - malbarbo:bump-jobserver, r=alexcrichton
Bump jobserver to 0.1.4
2017-06-05 17:16:58 +00:00
Marco A L Barbosa 728694abf0 Bump jobserver to 0.1.4 2017-06-05 14:15:40 -03:00
bors bbb38dce7f Auto merge of #4118 - alexcrichton:hamt, r=matklad
Optimize a slew of Cargo internals

Cargo has historically had very little optimization applied to it. Despite that it's pretty speedy today but there's always a desire to be faster! I've noticed Cargo being particularly sluggish on projects like Servo and rust-lang/rust, so I started profiling and found quite a few low-hanging fruit!

This PR is a slew of optimizations across Cargo for various things found here and there. The banner optimizations are:

* Resolution with a lock file should be basically a noop in terms of execution time now. An optimization was done to avoid cloning `Context` unless necessary, and that basically means it doesn't get cloned now! As the number 1 source of slowdown in Cargo this is the biggest improvement.
* Lots of pieces in `resolve` are now `Rc<T>` for being more easily cloneable.
* `Summary` now internally contains an `Rc` like `Dependency`, making it much more quickly cloneable.
* `Registry` as a trait no longer returns a `Vec` but rather takes a closure to yield summaries up, removing lots of intermediate arrays.
* We no longer spawn a thread for all units of "fresh work", only when we're about to spawn a process.

Almost everything here was guided through profiling `./x.py build` on rust-lang/rust or `cargo build -p log` on Servo. Both of these stress "noop resolution" and the former also stresses noop builds.

Runs of `./x.py build` dropped from 4 to 2 seconds (with lots of low-hanging fruit still remaining in Cargo itself) and `cargo build -p log` dropped from 1.5s to 0.3s. Massif graphs showing Cargo's memory usage also show that the peak memory usage of Cargo in a noop build of Servo dropped from 300MB to 30MB during resolution.

I'm hoping that none of these optimizations makes the code less readable and/or understandable. There are no algorithmic improvements in this PR other than those transitively picked up by making clones cheaper and/or allocating less.
2017-06-05 14:49:59 +00:00
Alex Crichton a389d483b1 Fix tests 2017-06-05 07:49:41 -07:00
Alex Crichton e3835f7055 Remove the RefCell from PackageRegistry
Some choice refactoring makes it no longer necessary!
2017-06-05 07:36:44 -07:00
Alex Crichton 857c19cc05 Comment about Clone on Context 2017-06-05 07:36:44 -07:00
Alex Crichton fc785ea273 Type alias activations to consolidate definition
Avoids duplicating tons of maps!
2017-06-05 07:36:44 -07:00
Alex Crichton d7c8c1894e Remove stray Registry impls
They're basically barely used now anyway.
2017-06-05 07:36:44 -07:00
Alex Crichton 19e0fa641d Avoid stack overflow when dropping RcList
Turn recursion into a loop
2017-06-05 07:36:44 -07:00
Alex Crichton c9fd94a464 Remove Clone for a struct we don't want cloned
It's super expensive to clone a `Resolve` and the resolution implementation no
longer needs to do so, let's remove the impl.
2017-06-05 07:36:44 -07:00
Alex Crichton 86774bd87b Reorganize PackageRegistry::query a bit
Less branches and more intuitive flow.
2017-06-05 07:36:44 -07:00
Alex Crichton 60aadc583d Remove DependencyInner as a public API
No need for it to be exposed any more, let's just use `Rc::make_mut`
judiciously.
2017-06-05 07:36:44 -07:00
Alex Crichton e6649dfa6d Cache Context::target_filenames
Relatively expensive to calculate, never changes, easy to add a cache!
2017-06-05 07:36:44 -07:00
Alex Crichton 0af2914bd9 Don't spawn threads for fresh work
On "fresh" builds this ends up just wasting a lot of time!
2017-06-05 07:36:44 -07:00
Alex Crichton 74777c1274 Remove more allocatoins in index querying
Removing some allocations arounds the stored hashes by having nested hash maps
instead of tuple keys. Also remove an intermediate array when parsing
dependencies through a custom implementation of `Deserialize`. While this
doesn't make this code path blazingly fast it definitely knocks it down in the
profiles below other higher-value targets.
2017-06-05 07:36:44 -07:00
Alex Crichton c122e600cf Cut down allocations in Display impls
Avoid unnecessary `String` allocations in hot paths that get run a lot for large
graphs.
2017-06-05 07:36:44 -07:00
Alex Crichton d303306d37 Optimize allocations in the registry index
Avoid some unnecessary clones, `to_vec`, etc. Not super optimizal but improves
the profile here regardless.
2017-06-05 07:36:44 -07:00
Alex Crichton 842c182e67 Optimize the interface of Registry.
Previously all intermediate stages would create and return `Vec<Summary>`, but
this is a pretty costly operation once you start layering. Ideally we'd use an
iterator-based approach here but working with that in trait objects is
difficult, so this commit takes a closure-based approach to avoid all the
intermediate allocations that are thrown away.
2017-06-05 07:36:44 -07:00
Alex Crichton 337359afdf Try to not allocate when decoding registry json
There's a few keys we don't need owned versions of, so try using Serde's
zero-copy deserialization where we can.
2017-06-05 07:36:44 -07:00
Alex Crichton e8b30f3009 Use Rc::make_mut in Dependency
Follow the same pattern with `Summary`
2017-06-05 07:36:44 -07:00
Alex Crichton 0d17d6c4b1 Make Summary::clone cheap with an inner Rc
This already happens in a few other places in Cargo (e.g. `Dependency`) and
`Summary` cloning turned up high in the profile, so let's make it cheaper.
2017-06-05 07:36:44 -07:00
Alex Crichton 48446574a6 Optimize resolution by removing allocations
This commit is a relatively serious optimization pass of the resolution phase in
Cargo, targeted at removing as many allocations as possible from this phase.
Executed as an iterative loop this phase of Cargo can often be costly for large
graphs but it's run on every single build!

The main optimization here is to avoid cloning the context and/or pushing a
backtracking frame if there are no candidates left in the current list of
candidates. That optimizes a fast-path for crates with lock files (almost all of
them) and gets us to the point where cloning the context basically disappears
from all profiling.
2017-06-05 07:36:44 -07:00
bors aab5c348aa Auto merge of #4119 - fabricedesre:patch-1, r=alexcrichton
Fix typo in argument name.
2017-06-03 17:54:43 +00:00
Fabrice Desré cecf8faaf7 Fix typo in argument name. 2017-06-02 18:51:09 -07:00
bors 8fb6e7c157 Auto merge of #4110 - alexcrichton:jobserver, r=matklad
Add a GNU make jobserver implementation to Cargo

This commit adds a GNU make jobserver implementation to Cargo, both as a client
of existing jobservers and also a creator of new jobservers. The jobserver is
actually just an IPC semaphore which manifests itself as a pipe with N bytes
of tokens on Unix and a literal IPC semaphore on Windows. The rough protocol
is then if you want to run a job you read acquire the semaphore (read a byte on
Unix or wait on the semaphore on Windows) and then you release it when you're
done.

All the hairy details of the jobserver implementation are housed in the
`jobserver` crate on crates.io instead of Cargo. This should hopefully make it
much easier for the compiler to also share a jobserver implementation
eventually.

The main tricky bit here is that on Unix and Windows acquiring a jobserver token
will block the calling thread. We need to either way for a running job to exit
or to acquire a new token when we want to spawn a new job. To handle this the
current implementation spawns a helper thread that does the blocking and sends a
message back to Cargo when it receives a token. It's a little trickier with
shutting down this thread gracefully as well but more details can be found in
the `jobserver` crate.

Unfortunately crates are unlikely to see an immediate benefit of this once
implemented. Most crates are run with a manual `make -jN` and this overrides the
jobserver in the environment, creating a new jobserver in the sub-make. If the
`-jN` argument is removed, however, then `make` will share Cargo's jobserver and
properly limit parallelism.

Closes #1744
2017-06-02 22:53:36 +00:00
Alex Crichton cbf25a9b0a Add a GNU make jobserver implementation to Cargo
This commit adds a GNU make jobserver implementation to Cargo, both as a client
of existing jobservers and also a creator of new jobservers. The jobserver is
actually just an IPC semaphore which manifests itself as a pipe with N bytes
of tokens on Unix and a literal IPC semaphore on Windows. The rough protocol
is then if you want to run a job you read acquire the semaphore (read a byte on
Unix or wait on the semaphore on Windows) and then you release it when you're
done.

All the hairy details of the jobserver implementation are housed in the
`jobserver` crate on crates.io instead of Cargo. This should hopefully make it
much easier for the compiler to also share a jobserver implementation
eventually.

The main tricky bit here is that on Unix and Windows acquiring a jobserver token
will block the calling thread. We need to either way for a running job to exit
or to acquire a new token when we want to spawn a new job. To handle this the
current implementation spawns a helper thread that does the blocking and sends a
message back to Cargo when it receives a token. It's a little trickier with
shutting down this thread gracefully as well but more details can be found in
the `jobserver` crate.

Unfortunately crates are unlikely to see an immediate benefit of this once
implemented. Most crates are run with a manual `make -jN` and this overrides the
jobserver in the environment, creating a new jobserver in the sub-make. If the
`-jN` argument is removed, however, then `make` will share Cargo's jobserver and
properly limit parallelism.

Closes #1744
2017-06-02 08:06:30 -07:00
bors 618a02926a Auto merge of #4117 - brson:vs2017, r=alexcrichton
Update gcc crate for MSVC 2017

This is just a slightly more correct version of the gcc crate, but shouldn't have any practical changes.
2017-06-01 22:20:28 +00:00
bors 3b4cb7c0c9 Auto merge of #4116 - alexcrichton:enotsupp, r=Mark-Simulacrum
Ignore ENOTSUP in file locking on Linux too

Apparently there are some filesystems that return this!

Closes #4096
2017-06-01 21:07:58 +00:00
Brian Anderson a7cbd5eba1 Update gcc crate for MSVC 2017 2017-06-01 21:01:17 +00:00
Alex Crichton 7e3e9b2d01 Ignore ENOTSUP in file locking on Linux too
Apparently there are some filesystems that return this!

Closes #4096
2017-06-01 13:58:27 -07:00
bors 30ebc17582 Auto merge of #4038 - nisargthakkar:newBadgesAdd, r=alexcrichton
Updating doc to reflect new badges added

The badges added are:
Is it maintained: Resolution time
Is it maintained: Percentage of open issues
Codecov: Code coverage
Coveralls: Code coverage
2017-06-01 16:53:07 +00:00
bors 03c0a41f97 Auto merge of #4090 - jluner:master, r=alexcrichton
Add error-chain errors.

Fixes #4209

Convert CargoResult, CargoError into an implementation provided by error-chain. The previous is_human machinery is mostly removed; now errors are displayed unless of the Internal kind, verbose mode will print all errors.
2017-05-31 22:51:31 +00:00
bors b30694b4d9 Auto merge of #4113 - alexcrichton:trim-travis, r=alexcrichton
Remove lots of dated configuration from this repo

Lots of data build stuff is still here from awhile ago when this repo was
producing Cargo binaries, but the rust-lang/rust repo is now responsible for all
these binaries and build configurations. We no longer need to produce artifacts
or have tons of cross-compiles as rust-lang/rust does all that work, instead
let's just test the likely-to-regress platforms and have rust-lang/rust take
care of the rest.

This commit:

* Deletes the old `configure` script and `Makefile`
* Rewrites `src/doc` management as a shell script
* Trims down Travis/AppVeyor configuration
2017-05-31 21:23:36 +00:00
Alex Crichton 50a46f4708 Remove lots of dated configuration from this repo
Lots of data build stuff is still here from awhile ago when this repo was
producing Cargo binaries, but the rust-lang/rust repo is now responsible for all
these binaries and build configurations. We no longer need to produce artifacts
or have tons of cross-compiles as rust-lang/rust does all that work, instead
let's just test the likely-to-regress platforms and have rust-lang/rust take
care of the rest.

This commit:

* Deletes the old `configure` script and `Makefile`
* Rewrites `src/doc` management as a shell script
* Trims down Travis/AppVeyor configuration
2017-05-31 14:23:01 -07:00
jluner def249f9c1 Fixes review comments
Fix some formatting items.
Changes Internal error kind to preserve the original error.
Changes network retry logic to inspect full error chain for spurious
errors.
2017-05-30 22:15:07 -05:00
jluner 68f558402c Restore macro_use 2017-05-28 10:13:59 -05:00