-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[experiment] How expensive are doc comments? #60930
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
@bors try |
[experiment] How expensive are doc comments? What happens if they are interpreted as usual comments and not converted to attributes, and not stored in AST/HIR? (This cannot be checked at lexer level, unfortunately, since some popular crates (`rayon`) rely on `/** text */` being matched by `#[$meta]` in macros.) r? @ghost
The job 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 |
☀️ Try build successful - checks-travis |
@rust-timer build 87205d7 |
Success: Queued 87205d7 with parent 73a3a90, comparison URL. |
Finished benchmarking try commit 87205d7: comparison url |
Turns out they are pretty expensive... |
Note that my experiments indicate that the main part of the cost is decoding the attributes from metadata. |
Cheaper doc comments This PR implements the idea from #60935: represent doc comments more cheaply, rather than converting them into `#[doc="..."]` attribute form. Unlike #60936 (which is about coalescing doc comments to reduce their number), this approach does not have any backwards compatibility concerns, and it eliminates about 80-90% of the current cost of doc comments (as estimated using the numbers in #60930, which eliminated the cost of doc comments entirely by treating them as normal comments). r? @petrochenkov
What happens if they are interpreted as usual comments and not converted to attributes, and not stored in AST/HIR?
(This cannot be checked at lexer level, unfortunately, since some popular crates (
rayon
) rely on/** text */
being matched by#[$meta]
in macros.)r? @ghost