Skip to content
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

[experiment] How expensive are doc comments? #60930

Closed
wants to merge 1 commit into from

Conversation

petrochenkov
Copy link
Contributor

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

@petrochenkov petrochenkov added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 18, 2019
@petrochenkov
Copy link
Contributor Author

@bors try

@bors
Copy link
Contributor

bors commented May 18, 2019

⌛ Trying commit 0283814 with merge 87205d7...

bors added a commit that referenced this pull request May 18, 2019
[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
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). 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.
travis_time:end:05e97ec4:start=1558140177232233691,finish=1558140178032247174,duration=800013483
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:26:10] 
[01:26:10] running 143 tests
[01:26:13] i..iii.....iii..iiii.....i......................i...i................i.....i...........iii..i..i.ii. 100/143
[01:26:15] test result: ok. 113 passed; 0 failed; 30 ignored; 0 measured; 0 filtered out
[01:26:15] 
[01:26:15]  finished in 4.519
[01:26:15] travis_fold:end:test_codegen
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:26:17] 
[01:26:17] running 9 tests
[01:26:17] iiiiiiiii
[01:26:17] 
[01:26:17]  finished in 0.161
[01:26:17] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:26:33] 
[01:26:33] running 122 tests
[01:26:59] .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....i..........iiii..........i...ii...i.......ii.i 100/122
[01:27:04] .i.i......iii.i.....ii
[01:27:04] 
[01:27:04]  finished in 31.050
[01:27:04] travis_fold:end:test_debuginfo

---

[01:31:17] travis_fold:start:test_rustdoc
travis_time:start:test_rustdoc
Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:31:17] thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:997:5
[01:31:17] 
[01:31:17] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:31:17] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:31:17] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/rustdoc" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "rustdoc" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:31:17] 
[01:31:17] 
[01:31:17] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:31:17] Build completed unsuccessfully in 0:17:24
[01:31:17] Build completed unsuccessfully in 0:17:24
[01:31:17] Makefile:48: recipe for target 'check' failed
[01:31:17] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:29236e6b
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Sat May 18 02:14:25 UTC 2019

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. (Feature Requests)

@bors
Copy link
Contributor

bors commented May 18, 2019

☀️ Try build successful - checks-travis
Build commit: 87205d7

@Centril
Copy link
Contributor

Centril commented May 18, 2019

@rust-timer build 87205d7

@rust-timer
Copy link
Collaborator

Success: Queued 87205d7 with parent 73a3a90, comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 87205d7: comparison url

@Centril
Copy link
Contributor

Centril commented May 18, 2019

Turns out they are pretty expensive...

@petrochenkov
Copy link
Contributor Author

I had some optimization ideas for doc comments (#60935, #60936) and wanted to check how much effect they can have.

@nnethercote
Copy link
Contributor

Note that my experiments indicate that the main part of the cost is decoding the attributes from metadata.

bors added a commit that referenced this pull request Nov 7, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-perf Status: Waiting on a perf run to be completed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants