simplify some proc_macro things#157271
Conversation
|
rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer |
|
rustbot has assigned @petrochenkov. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
simplify some `proc_macro` things
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (aba743d): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 0.4%, secondary -5.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.9%, secondary -2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 511.375s -> 517.888s (1.27%) |
|
|
||
| fn ts_drop(&mut self, stream: Self::TokenStream) { | ||
| drop(stream); | ||
| } |
There was a problem hiding this comment.
Wouldn't this cause all tokenstreams to be unnecessarily retained on the server side until the end of the proc macro invocation even if the client drops it earlier?
There was a problem hiding this comment.
Yeah, the motivation is missing for this change now - what did this drop do, what happens now when it's removed, why it's good.
| // We have the array method separate from extending from a slice. This is | ||
| // because in the case of small arrays, codegen can be more efficient | ||
| // (avoiding a memmove call). With extend_from_slice, LLVM at least | ||
| // currently is not able to make that optimization. |
There was a problem hiding this comment.
Any specific reason to remove this optimization?
It would probably be better to benchmark it separately in any case.
| len: usize, | ||
| capacity: usize, | ||
| reserve: extern "C" fn(Buffer, usize) -> Buffer, | ||
| drop: extern "C" fn(Buffer), |
There was a problem hiding this comment.
Why is it better to directly manage Buffer memory without using Vec?
Each commit should be reviewable on its own. Locally, this also resulted in some slightly better perf results.