Uh oh!
There was an error while loading. Please reload this page.
Use Rc<str> and Rc<[T]> instead of Rc<String> and Rc<Vec<T>> - #49645
Use Rc<str> and Rc<[T]> instead of Rc<String> and Rc<Vec<T>>#49645birkenfeld wants to merge 3 commits into
Conversation
kennytm
commented
Apr 4, 2018
@bors try I'd like to check the perf. cc @Mark-Simulacrum |
bors
commented
Apr 4, 2018
Use Rc<str> and Rc<[T]> instead of Rc<String> and Rc<Vec<T>> to save a bit of memory and pointer chasing. For the `Vec<T>` case, there is one instance each of `get_mut` and `make_mut` that preclude the use of the slice type: * the `get_mut` one does `push`, so I left it as is * the `make_mut` one does a `reverse`, which would be fine but `Lrc<[T]>` does not impl `Clone` (should it?) - however, the reverse seems to be unnecessary - please if the solution makes sense Had some unrelated-looking local test failures, let's see if if CI gets them too.
TimNN
commented
Apr 4, 2018
Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@TimNN Questionable fragment ;) Fixing the test now... |
There was a problem hiding this comment.
I think we shouldn't promote use of Rc<String>, rather show that Rc<str> is now feasible and preferable.
TimNN
commented
Apr 4, 2018
Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
kennytm
commented
Apr 4, 2018
The try build is successful. Again, the reply is missing, probably because new commits are pushed in between. Anyway, please schedule |
TimNN
commented
Apr 4, 2018
Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Mark-Simulacrum
commented
Apr 4, 2018
Try build queued for perf. |
nikomatsakis
left a comment
There was a problem hiding this comment.
so r=me for the compiler stuff, but I don't feel qualified to r+ the changes to the libstd docs
nikomatsakis
commented
Apr 4, 2018
r? @steveklabnik for the changes to hashmap example etc |
kennytm
commented
Apr 5, 2018
Ignoring the spurious |
bors
commented
Apr 5, 2018
☔ The latest upstream changes (presumably #49696) made this pull request unmergeable. Please resolve the merge conflicts. |
There is one instace where Lrc::get_mut().unwrap() is used on the reference to make a push, this cannot be converted. One instance of Lrc::make_mut() was removed -- the side effect of changing the original vector cannot have mattered since make_mut() might have cloned it.
birkenfeld
commented
Apr 7, 2018
Updated. |
bors
commented
Apr 7, 2018
☔ The latest upstream changes (presumably #49672) made this pull request unmergeable. Please resolve the merge conflicts. |
Hmm. I'm torn on this change. I wouldn't expect a real performance win -- as we saw on perf, this is basically in the noise, which is what I would expect. (Note also that even when judged from a "micro-efficiency" perspective, this is not an obvious win: My bigger concern though is that constructing a Note all that we don't really get much increased flexibility here. e.g.,, given a So in summary:
cc @rust-lang/compiler -- thoughts? |
oli-obk
commented
Apr 10, 2018
👍 for elegance |
eddyb
commented
Apr 10, 2018
Yeah - you need |
kennytm
commented
Apr 10, 2018
Actually I would have expected a performance loss because constructing a |
Zoxc
commented
Apr 10, 2018
I've been wanting to get rid of the |
emilyalbini
commented
Apr 16, 2018
Ping from triage! What's the status of this PR? |
1 similar comment
emilyalbini
commented
Apr 23, 2018
Ping from triage! What's the status of this PR? |
Looks like the change is not unanimous, and a significant part is likely to be refactored away, so I'll close it. |
to save a bit of memory and pointer chasing.
For the
Vec<T>case, there is one instance each ofget_mutandmake_mutthat preclude the use of the slice type:get_mutone doespush, so I left it as ismake_mutone does areverse, which would be fine butLrc<[T]>does not implClone(should it?) - however, the reverse seems to be unnecessary - please check if the solution makes senseHad some unrelated-looking local test failures, let's see if if CI gets them too.