Skip to content

Rust 1.12 release announcement #126

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

Merged
merged 20 commits into from
Sep 29, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 84 additions & 24 deletions _posts/2016-09-29-Rust-1.12.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ website, and check out the [detailed release notes for 1.12.0][notes] on GitHub.
1361 patches were landed in this release.

[install]: https://www.rust-lang.org/install.html
[notes]: https://github.com/rust-lang/rust/blob/stable/RELEASES.md#version-1120-2016-09-29
[notes]: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1120-2016-09-29

### What's in 1.12.0 stable

Expand Down Expand Up @@ -93,34 +93,31 @@ upcoming changes to the compiler enabled by MIR is a rewrite of the pass that
generates LLVM IR, what `rustc` calls "translation", and after many months of
effort the MIR-based backend has proved itself ready for prime-time.

TODO: Improve code complexity: size of old trans vs size of new trans.

MIR exposes perfect information about the program's control flow, so the
compiler knows exactly whether types are moved or not. This means that it knows
statically whether or not the value's destructor needs to be run. In cases where
a value may or may not be moved at the end of a scope, the compiler now simply
uses a single bitflag on the stack, which is in turn easier for optimization
passes in LLVM to reason about. The end result is less work for the compiler and
less bloat at runtime.

The improvements in compile times of some workloads due to this change alone are
significant:

| | 1.11 | 1.12 | compile time |
|---------------|--------|-------|---------------|
| inflate-0.1.0 | 10.17s | 4.32s | 2.35x faster |
| hyper-0.5.0 | 24.03s | 5.23s | 4.58x faster |
| helloworld | 0.17s | 0.14s | 1.20x faster |
| regex 0.1.30 | 9.63s | 2.39s | 4.03x faster |
statically whether or not the value's destructor needs to be run. In cases
where a value may or may not be moved at the end of a scope, the compiler now
simply uses a single bitflag on the stack, which is in turn easier for
optimization passes in LLVM to reason about. The end result is less work for
the compiler and less bloat at runtime. In addition, because MIR is a simpler
'language' than the full AST, it's also easier to implement compiler passes on,
and easier to verify that they are correct.

The improvements in compile times of some workloads due to this change alone
are significant:

| | 1.11 | 1.12 | compile time |
|---------------|--------|-------|--------------|
| inflate-0.1.0 | 10.17s | 4.32s | 2.35x faster |
| hyper-0.5.0 | 24.03s | 5.23s | 4.58x faster |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to reproduce this, but so far I'm not seeing this improvement.

"cargo build" of a project that depends on hyper 0.5.0:
1.11: 0m26.975s
beta: 0m31.901s

"cargo build --release" of a project that depends on hyper 0.5.0:
1.11: 0m40.412s
beta: 0m43.502s

Does anyone know how to repro this chart? @eddyb? @nikomatsakis?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should mention that I got the table numbers from perf.rust-lang.org

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME FIXME FIXME FIXME FIXME
WARNING WARNING WARNING

The perf numbers could not be verified. It seems perf.rust-lang.org was giving us bogus values. We tried to repro the improvements and were not able to.

We'll need to remove these, sadly :(

On the plus side, I did see improvements compared to nightly, so there are some improvements coming. They're just not in 1.12.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonathandturner The improvements you are seeing in nightly are likely due to rust-lang/rust#36524

| helloworld | 0.17s | 0.14s | 1.20x faster |
| regex 0.1.30 | 9.63s | 2.39s | 4.03x faster |

It is worth remembering that not all workloads may see this large of an
improvement: it depends on a large number of factors.

TODO: Future improvements.

TODO: non-zeroing drop PR https://github.com/rust-lang/rust/pull/33622

[Memory usage](https://en.wikipedia.org/wiki/Resident_set_size):
The compiler's [memory usage](https://en.wikipedia.org/wiki/Resident_set_size)
while compiling these crates was also improved:

| | 1.11 | 1.12 | % of original size |
|---------------|-------|-------|--------------------|
Expand All @@ -129,14 +126,77 @@ TODO: non-zeroing drop PR https://github.com/rust-lang/rust/pull/33622
| helloworld | 127MB | 90MB | 70.9% |
| regex.0.1.30 | 230MB | 194MB | 84.3% |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the memory usage of rustc or of the compiled program? Might want to clarify that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to use the percent decrease with a minus sign, I initially wondered if the MIR transition were that good.


[RFC 320]: https://github.com/rust-lang/rfcs/blob/master/text/0320-nonzeroing-dynamic-drop.md
#### Other improvements

* Many minor improvements to the documentation.
* [`rustc` supports three new MUSL targets on ARM: `arm-unknown-linux-musleabi`,
`arm-unknown-linux-musleabihf`, and `armv7-unknown-linux-musleabihf`]
(https://github.com/rust-lang/rust/pull/35060).
These targets produce statically-linked binaries. There are no binary release
builds yet though.
* In error descriptions,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"more human errors"?

[references](https://github.com/rust-lang/rust/pull/35611) and [unknown numeric
types](https://github.com/rust-lang/rust/pull/35080) have more human errors.
* [The compiler can now be built against LLVM 3.9]
(https://github.com/rust-lang/rust/pull/35594)
* [Test binaries now support a `--test-threads` argument to specify the number
of threads used to run tests, and which acts the same as the
`RUST_TEST_THREADS` environment variable]
(https://github.com/rust-lang/rust/pull/35414)
* [The test runner now emits a warning when tests run over 60 seconds]
(https://github.com/rust-lang/rust/pull/35405)
* [Rust releases now come with source packages that can be installed by rustup
via `rustup component add rust-src`]
(https://github.com/rust-lang/rust/pull/34366).
The resulting source code can be used by tools and IDES, located in the
sysroot under `lib/rustlib/src`.

See the [detailed release notes][notes] for more.

#### Library stabilizations

This release sees a number of small quality of life improvements for various
types in the standard library:

* [`Cell::as_ptr`](https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_ptr)
and
[`RefCell::as_ptr`](https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.as_ptr)
* `IpAddr`, `Ivp4Addr`, and `Ipv6Addr` have a few new methods.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're all separate, and there's a ton of them. Not sure how best to do the links here.

* [`LinkedList`](https://doc.rust-lang.org/std/collections/linked_list/struct.LinkedList.html#method.contains)
and
[`VecDeque`](https://doc.rust-lang.org/std/collections/vec_deque/struct.VecDeque.html#method.contains)
have a new `contains` method.
* [`iter::Product`](https://doc.rust-lang.org/std/iter/trait.Product.html) and
[`iter::Sum`](https://doc.rust-lang.org/std/iter/trait.Sum.html)
* [`Option` implements `From` for its contained type]
(https://github.com/rust-lang/rust/pull/34828)
* [`Cell`, `RefCell` and `UnsafeCell` implement `From` for their contained type]
(https://github.com/rust-lang/rust/pull/35392)
* [`Cow<str>` implements `FromIterator` for `char`, `&str` and `String`]
(https://github.com/rust-lang/rust/pull/35064)
* [Sockets on Linux are correctly closed in subprocesses via `SOCK_CLOEXEC`]
(https://github.com/rust-lang/rust/pull/34946)
* [`String` implements `AddAssign`]
(https://github.com/rust-lang/rust/pull/34890)
* [Unicode definitions have been updated to 9.0]
(https://github.com/rust-lang/rust/pull/34599)

See the [detailed release notes][notes] for more.

#### Cargo features

Cargo has some modest improvments:

* [Support local mirrors of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems like a biggie -- maybe worth pulling out into a brief paragraph? Maybe talk to @alexcrichton about it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, how about something like:


The biggest feature added to Cargo this cycle is the ability to [override the source of a crate](link here). Using this tools like cargo-vendor and cargo-local-registry allow vendoring dependencies locally in a robust fashion. Eventually this support will be the foundation of supporting mirrors of crates.io as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great. I wanted to do this, but it got lost in the rest of it.

registries](https://github.com/rust-lang/cargo/pull/2857)
* [Speed up noop registry updates](https://github.com/rust-lang/cargo/pull/2974)
* [Add a `--lib` flag to `cargo new`]
(https://github.com/rust-lang/cargo/pull/2921)
* [Indicate the compilation profile after compiling]
(https://github.com/rust-lang/cargo/pull/2909)
* [Add `--dry-run` to `cargo publish`]
(https://github.com/rust-lang/cargo/pull/2849)

See the [detailed release notes][notes] for more.

### Contributors to 1.12.0
Expand Down