Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upspecialize ToString for str #32586
Conversation
rust-highfive
assigned
alexcrichton
Mar 29, 2016
This comment has been minimized.
This comment has been minimized.
|
(rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
Travis is unhappy: https://travis-ci.org/rust-lang/rust/builds/119328869 |
sfackler
added
the
T-libs
label
Mar 29, 2016
This comment has been minimized.
This comment has been minimized.
|
Thanks for the PR! @rust-lang/libs actually just started talking about whether we want to use specialization in the standard library. The conclusion so far is that we don't want want to make any strong commitments in terms of enabling new functionality just yet (as specialization isn't 100% on the path to stabilization yet), but small perf improvements like this seem reasonable for the standard library to do. I'm personally in favor of a change like this to test out specialization, but if we hit ICEs here and there we should be ready to revert relatively quickly. |
japaric
referenced this pull request
Mar 30, 2016
Closed
"".to_string() is slower than String::new() #18404
This comment has been minimized.
This comment has been minimized.
|
Does |
This comment has been minimized.
This comment has been minimized.
|
Nope - it should probably be change to stable. |
seanmonstar
force-pushed the
seanmonstar:speialize-to-string
branch
from
67fac0c
to
fc8cf9c
Mar 30, 2016
This comment has been minimized.
This comment has been minimized.
|
Fixed stability attribute. |
This comment has been minimized.
This comment has been minimized.
|
The libs team discussed this during triage today and the decision was to merge! This does not expand the standard library's API surface area, provides a clear performance benefit, and it's very difficult to rely on specialization where code would break if we removed it for whatever reason. @aturon was also "very confident" that this would not ICE :) Thanks for the PR @seanmonstar! |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton ... I did suggest a crater run ;-) |
This comment has been minimized.
This comment has been minimized.
|
Oh oops I may have misinterpreted in that case. I'll schedule a crater run. @bors: r- |
This comment has been minimized.
This comment has been minimized.
|
Crater says zero regressions, yay! |
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Apr 1, 2016
This comment has been minimized.
This comment has been minimized.
bors
merged commit fc8cf9c
into
rust-lang:master
Apr 1, 2016
This comment has been minimized.
This comment has been minimized.
|
Cool! More procedural question: This type of change makes the blanket ToString impl downstream specializable. Do we want this? What do we need to think of when deciding whether to allow that with a |
This comment has been minimized.
This comment has been minimized.
|
@bluss Very good question. We talked about this some in a recent libs meeting -- ultimately, we're going to want a conventions RFC here, I think. But it's hard to get there without some experimentation first. |
bluss
referenced this pull request
Apr 3, 2016
Merged
Specialize equality for [T] and comparison for [u8] to use memcmp when possible #32699
This comment has been minimized.
This comment has been minimized.
RFC 1422 gives a general way to limit various permissions. The RFC talks only about permission to access ( In this particular case something like |
This comment has been minimized.
This comment has been minimized.
|
@petrochenkov You could take the approach in PR #32699 instead if specialization is not open to the outside (use an intermediate internal trait). |
seanmonstar commentedMar 29, 2016
If there was some conditional compiling we could do, such that this impl only exists in nightly, and is turned off in beta/stable, I think that'd be an improvement here, as we could test specialization out without affecting stable builds.