-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Remove OneVector type alias #53824
Remove OneVector type alias #53824
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
eff2d5c
to
6f3bbc0
Compare
This comment has been minimized.
This comment has been minimized.
6f3bbc0
to
29fd8a4
Compare
☔ The latest upstream changes (presumably #53832) made this pull request unmergeable. Please resolve the merge conflicts. |
FYI: I''ve started writing a smallvectune crate that can wrap |
29fd8a4
to
35ea50c
Compare
Rebased. |
This PR currently makes two changes:
The first change seems fine. I agree that I'm less satisfied by the second change. The description above says "it is used in scenarios where the capacity of 1 is often exceeded, which might be nullifying the performance wins" -- do you have any measurements showing this? My general approach is profile-driven: I assume the existing code is reasonable, and only change such things when I have measurements showing it helps. I'm not comfortable with a blanket approach of changing every To move forward I would suggest removing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Changes requested are above.)
src/libsyntax/ext/tt/transcribe.rs
Outdated
@@ -70,7 +70,7 @@ pub fn transcribe(cx: &ExtCtxt, | |||
interp: Option<FxHashMap<Ident, Rc<NamedMatch>>>, | |||
src: Vec<quoted::TokenTree>) | |||
-> TokenStream { | |||
let mut stack: OneVector<Frame> = smallvec![Frame::new(src)]; | |||
let mut stack: SmallVec<[Frame; 8]> = smallvec![Frame::new(src)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the one that is changed to 8, BTW.
35ea50c
to
d04a2a6
Compare
@nnethercote Thanks for the review! I wasn't aware these values were profiled and I now understand that changing them in an ad-hoc manner could be just as bad as spilling to the heap. I agree that waiting for a more precise solution is the right choice. The adjusted PR should make this future change easier. |
Well, it's possible they are profiled, I don't know for sure. You could work it out with
In this case measurements are the equivalent of the "Go away and think" part. |
smallvectune has reached its first milestone: The data collector should work now, and uses an MPSC to collect the traces, so it's all thread-safe and shouldn't be too much of a performance burden (that said, I haven't benchmarked it...). |
☔ The latest upstream changes (presumably #54277) made this pull request unmergeable. Please resolve the merge conflicts. |
Ping from triage! @nnethercote / @ljedrz: Could you confirm the status of this PR? IIUC, it now only removes a type alias and uses a SmallVec implementation from an external crate. |
As per #53824 (comment), I suggest that @ljedrz changes this PR to just be about removing |
@nnethercote actually I already did that. I'll rebase it, this change should make future size tuning easier. |
d04a2a6
to
130a32f
Compare
Rebased. |
Looking good! |
📌 Commit 130a32f has been approved by |
Remove OneVector, increase related SmallVec capacities Removes the `OneVector` type alias (equivalent to `SmallVec<[T; 1]>`); it is used in scenarios where the capacity of 1 is often exceeded, which might be nullifying the performance wins (due to spilling to the heap) expected when using `SmallVec` instead of `Vec`. The numbers I used in this PR are very rough estimates - it would probably be a good idea to adjust some/all of them, which is what this proposal is all about. It might be a good idea to additionally create some local type aliases for the `SmallVec`s in the `Folder` trait, as they are repeated in quite a few spots; I'd be happy to apply this sort of adjustments.
☀️ Test successful - status-appveyor, status-travis |
📣 Toolstate changed by #53824! Tested on commit c3a1a0d. 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra). |
Tested on commit rust-lang/rust@c3a1a0d. Direct link to PR: <rust-lang/rust#53824> 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra). 💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra). 💔 rls on windows: test-pass → build-fail (cc @nrc, @rust-lang/infra). 💔 rls on linux: test-pass → build-fail (cc @nrc, @rust-lang/infra).
fix breakage by rust-lang/rust#53824 use smallvec crate instead of rustcs type alias.
This broke interpolate idents. |
Removes the
OneVector
type alias (equivalent toSmallVec<[T; 1]>
); it is used in scenarios where the capacity of 1 is often exceeded, which might be nullifying the performance wins (due to spilling to the heap) expected when usingSmallVec
instead ofVec
.The numbers I used in this PR are very rough estimates - it would probably be a good idea to adjust some/all of them, which is what this proposal is all about.
It might be a good idea to additionally create some local type aliases for the
SmallVec
s in theFolder
trait, as they are repeated in quite a few spots; I'd be happy to apply this sort of adjustments.