You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Do not convert doc comments into #[doc = "..."] form unless necessary for macros #60935
Because TokenStream contains a Lrc<Vec<TreeAndJoint>>, this would avoid two allocations per doc comment line: one for the Lrc and one for the Vec. That would get a big chunk of the potential saving. (We would still need one symbol interning per line, which involves a TLS access and a hash table.)
I have a local patch that changes TokenStream to a Lrc<SmallVec<[TreeAndJoint; 2]>>. It's a clear win, but it only gets rid of one of the allocations, so the approach suggested in this PR has a greater potential.
Activity
nnethercote commentedon Oct 23, 2019
Because
TokenStreamcontains aLrc<Vec<TreeAndJoint>>, this would avoid two allocations per doc comment line: one for theLrcand one for theVec. That would get a big chunk of the potential saving. (We would still need one symbol interning per line, which involves a TLS access and a hash table.)nnethercote commentedon Oct 23, 2019
I have a local patch that changes
TokenStreamto aLrc<SmallVec<[TreeAndJoint; 2]>>. It's a clear win, but it only gets rid of one of the allocations, so the approach suggested in this PR has a greater potential.nnethercote commentedon Oct 24, 2019
I have implemented this idea in #65750. It works well!
Make doc comments cheaper with `AttrKind`.
Auto merge of #65750 - nnethercote:cheaper-doc-comments, r=petrochenkov