-
Notifications
You must be signed in to change notification settings - Fork 13.3k
MultiItemDecorator should take &Annotatable #25683
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
Comments
How large is annotatable? It only matters if it's expensive to clone. |
An Annotatable is generally an Item. In this case, mostly structs and enums. Cloning a struct in the AST isn't too expensive, but when you do it multiple times for almost every struct it adds up. I'm going to profile this for the heck of it and see. |
An |
It contains |
…fackler fixes rust-lang#25683 I have a very nonscientific measurement of the data via valgrind/massif [here](https://gist.github.com/Manishearth/4c47f15f6835cb3957c4) I measured the memory usage for both --pretty=expanded and -Z no-trans It *seems* like there's a 20-25MB decrease during expansion on stage2 librustc; but I'm not quite sure. r? @eddyb (have not yet run tests, but it compiles fine, might want to wait before giving r+) cc @nrc @huon
…fackler fixes rust-lang#25683 I have a very nonscientific measurement of the data via valgrind/massif [here](https://gist.github.com/Manishearth/4c47f15f6835cb3957c4) I measured the memory usage for both --pretty=expanded and -Z no-trans It *seems* like there's a 20-25MB decrease during expansion on stage2 librustc; but I'm not quite sure. r? @eddyb (have not yet run tests, but it compiles fine, might want to wait before giving r+) cc @nrc @huon
…fackler fixes rust-lang#25683 I have a very nonscientific measurement of the data via valgrind/massif [here](https://gist.github.com/Manishearth/4c47f15f6835cb3957c4) I measured the memory usage for both --pretty=expanded and -Z no-trans It *seems* like there's a 20-25MB decrease during expansion on stage2 librustc; but I'm not quite sure. r? @eddyb (have not yet run tests, but it compiles fine, might want to wait before giving r+) cc @nrc @huon
is deprecated in favor of
The new version takes the thing being decorated by-move, and this is achieved by a clone. The clone is totally unnecessary; a decorator doesn't modify the original item and should be fine with a simple reference to it.
This probably causes a lot of unnecessary clones since MultiDecorators are used everywhere in the form of
#[derive]
.Should we make this
&Annotatable
and remove the clone?cc @nrc @huonw
The text was updated successfully, but these errors were encountered: