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

Add DocFS layer to rustdoc #60971

Merged
merged 3 commits into from
Jun 22, 2019
Merged

Add DocFS layer to rustdoc #60971

merged 3 commits into from
Jun 22, 2019

Conversation

rbtcollins
Copy link
Contributor

@rbtcollins rbtcollins commented May 20, 2019

  • Move fs::create_dir_all calls into DocFS to provide a clean
    extension point if async extension there is needed.
  • Convert callsites of create_dir_all to ensure_dir to reduce syscalls.
  • Convert fs::write usage to DocFS.write
    (which also removes a lot of try_err! usage for easier reading)
  • Convert File::create calls to use Vec buffers and then DocFS.write
    in order to both consistently reduce syscalls as well as make
    deferring to threads cleaner.
  • Convert OpenOptions usage similarly - I could find no discussion on
    the use of create_new for that one output file vs all the other
    files render creates, if link redirection attacks are a concern
    DocFS will provide a good central point to introduce systematic
    create_new usage.
  • DocFS::write defers to rayon for IO on Windows producing a modest
    speedup: before this patch on my development workstation:

$ time cargo +mystg1 doc -p winapi:0.3.7
Documenting winapi v0.3.7
Finished dev [unoptimized + debuginfo] target(s) in 6m 11s

real 6m11.734s
user 0m0.015s
sys 0m0.000s

Afterwards:
$ time cargo +mystg1 doc -p winapi:0.3.7
Compiling winapi v0.3.7
Documenting winapi v0.3.7
Finished dev [unoptimized + debuginfo] target(s) in 49.53s

real 0m49.643s
user 0m0.000s
sys 0m0.015s

I haven't measured how much time is in the compilation logic vs in the
IO and outputting etc, but this takes it from frustating to tolerable
for me, at least for now.

@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:05d2d6ae:start=1558320515393783471,finish=1558320602561461127,duration=87167677656
$ 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
---
[00:55:24]    Compiling parking_lot_core v0.4.0
[00:55:30]    Compiling tempfile v3.0.5
[00:55:32]    Compiling parking_lot v0.7.1
[00:55:35]    Compiling rustdoc v0.0.0 (/checkout/src/librustdoc)
[00:55:35] error[E0583]: file not found for module `docfs`
[00:55:35]    |
[00:55:35]    |
[00:55:35] 61 | mod docfs;
[00:55:35]    |
[00:55:35]    |
[00:55:35]    = help: name the file either docfs.rs or docfs/mod.rs inside the directory "src/librustdoc"
[00:55:35] error: aborting due to previous error
[00:55:35] 
[00:55:35] For more information about this error, try `rustc --explain E0583`.
[00:55:35] error: Could not compile `rustdoc`.
---
travis_time:end:01a3b037:start=1558323947853311777,finish=1558323947857976465,duration=4664688
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1c2fbb65
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:20b656f8
travis_time:start:20b656f8
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:00895d93
$ dmesg | grep -i kill

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)

@rbtcollins rbtcollins changed the title WIP: Docs perf Add DocFS layer to rustdoc May 20, 2019
@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:0c67c584:start=1558396729181825675,finish=1558396820334010528,duration=91152184853
$ 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
---

[00:04:28] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:29] tidy error: /checkout/src/librustdoc/docfs.rs:50: TODO is deprecated; use FIXME
[00:04:29] tidy error: /checkout/src/librustdoc/html/render.rs:822: line longer than 100 chars
[00:04:29] tidy error: /checkout/src/librustdoc/html/render.rs:910: line longer than 100 chars
[00:04:29] tidy error: /checkout/src/librustdoc/html/render.rs:916: line longer than 100 chars
[00:04:29] tidy error: /checkout/src/librustdoc/html/render.rs:1134: line longer than 100 chars
[00:04:29] tidy error: /checkout/src/librustdoc/html/render.rs:1276: line longer than 100 chars
[00:04:34] some tidy checks failed
[00:04:34] 
[00:04:34] 
[00:04:34] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:34] 
[00:04:34] 
[00:04:34] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:34] Build completed unsuccessfully in 0:01:18
[00:04:34] Build completed unsuccessfully in 0:01:18
[00:04:34] Makefile:67: recipe for target 'tidy' failed
[00:04:34] make: *** [tidy] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1ce6bd70
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue May 21 00:05:03 UTC 2019
---
travis_time:end:0153988e:start=1558397104583964642,finish=1558397104590241530,duration=6276888
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:02bd203f
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0021ecb5
travis_time:start:0021ecb5
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:104b0fe0
$ dmesg | grep -i kill

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)

@rbtcollins rbtcollins force-pushed the docs-perf branch 3 times, most recently from 7f52e24 to cc11f7b Compare May 21, 2019 02:33
@rbtcollins
Copy link
Contributor Author

I think this is complete now; if it fails CI obviously I'll fix it, but barring review feedback, I have no further planned changes.

Err(e) => {
// In principle these should get displayed at the top
// level, but just in case, send to stderr as well.
eprintln!("\"{}\": {}", path.display(), e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like your comment stated, isn't it a duplicate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm not 100% sure. I'd hate for a user to have a bad experience tracking down a problem because we failed to report an error reliably. The cost is perhaps showing the error twice. The benefit is increased surity it is delivered. A different code structure where e.g. we actually collected the results rather than tossing them into the void and letting the threadpool infra collect panics would be preferrable, but that will require considerably more work.

Ultimately though, I'm not going to get the bug reports from users that wonder why things are not reported, if in fact there are any reporting issues, so, if you want the eprintln! removed, just say so and I'll remove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about storing all those errors in a struct that is created outside the threads and just return from the current thread. Then print all the stored errors. Wouldn't it be a bit better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know enough about how and where the rustdoc internals are used to know what assumptions are safe to make in that regard. Is librustdoc used as a library, or is it really just the used by the CLI? Are there other entry points in, or is gathering in render appropriate? We could use an mpsc to gather feedback from threads and examine that in run()?

That could be done in a follow up patch too though, it doesn't need to be done in this iteration.

TBH, I'd like to hand this over to someone interested in maintaining the code: it was mainly a drive by test to see if the lessons learnt in rustup were applicable to rustdoc based on a twitter conversation: they appear to be so. I've polished it to the point where I believe that its correct - it should not violated any existing assumptions in the code (e.g. the flock requirements for shared file writing), and I believe that this patch as-is is unlikely to create new bug reports for the team). Equally I'm sure that many more things can be done to it to make it much better - such as gathering the results of the IO calls into a mpsc queue or similar. Further profiling would also allow identifying how much of the remaining time is compiler performance and so on; a minute is a long time - unpacking the entire rust std docs is only 17 seconds or so on this machine with a very similar approach.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make a few changes on your branch then if you don't mind. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do, I'd hate the effort of prototyping to be wasted, but you're in a much better position to assess the interactions raised here, unless I find a chunk of time I just don't have right now.

Copy link
Member

@GuillaumeGomez GuillaumeGomez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very nice! Just a few questions but otherwise I think we're good to go!

@rbtcollins
Copy link
Contributor Author

I've toggled on 'allow edits from maintainers', (its night time here, rather than waiting a day for me if I've gone to sleep etc etc).so if you want to remove the eprintln! you can do so yourself.

@GuillaumeGomez
Copy link
Member

We're not in a hurry and I prefer to not interfere directly with contributors code if not needed as much possible. We'll come back to it when you're back. Like I said: we're not in a hurry. Thanks for your PR in any case!

@rbtcollins
Copy link
Contributor Author

I replied to that review comment anyhow - currently waiting on a reply to that reply :).

@rbtcollins
Copy link
Contributor Author

I replied to that review comment anyhow - currently waiting on a reply to that reply :).

Bah, github just hadn't shown me your reply; have replied now.

@GuillaumeGomez
Copy link
Member

@rbtcollins: Tell me what you think of my changes (just look at the last commit for that).

@bors
Copy link
Contributor

bors commented May 30, 2019

☔ The latest upstream changes (presumably #61343) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 30, 2019
@rbtcollins
Copy link
Contributor Author

Hi sorry for not getting back more quickly. There is a race condition in the patch added I think. add_error is atomic, but there is nothing that tells write_errors whether there is pending incomplete io that has yet to report an error. So between the end of cx.krate() and the call to write_errors(), io that has started but not completed will carry on after the end of run() - which it did in the first patch too. But then when the rayon runtime waits for it to complete, the error that it has will report into the ErrorStorage struct, nothing will consult the ErrorStorage struct, and the error will go unreported.

@GuillaumeGomez
Copy link
Member

I thought about it as well but was wondering if it'd slow down your implementation too much, at which point, making it useless. I'll update to wait for all threads to be completed before returning.

@rbtcollins
Copy link
Contributor Author

I think if you use an mpsc, hand a tx.clone() into the thread, and send either a Result() or an Option back, and in run() you can just iter() the results, you'll be race free and won't need to muck with mutexes or anything else. Just make sure to drop the tx channel after krate() returns (so that iter() won't block once the last IO completes).

@GuillaumeGomez
Copy link
Member

Ok, I went for full channel system. However I'm worried about the possibility that rustdoc gets stuck in case a channel error occurs.

/// Prints all stored errors. Returns the number of printed errors.
pub fn write_errors(&self, diag: &errors::Handler) -> usize {
let mut printed = 0;
let nb_threads: usize = *self.nb_threads.borrow();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove nb_threads.
drop self.sender here, otherwise if a thread has paniced and not sent a response, you will block. (see below).

drop(self.sender)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't just drop it like that. I'll try to find a workaround.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, you can - I have in similar code elsewhere. Might need to use mem::replace in a pinch. Would you like me to do this iteration? I have a couple hours available.

src/librustdoc/docfs.rs Outdated Show resolved Hide resolved
pub struct ErrorStorage {
sender: Sender<Option<String>>,
receiver: Receiver<Option<String>>,
nb_threads: RefCell<usize>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove nb_threads (see below)

src/librustdoc/docfs.rs Outdated Show resolved Hide resolved
src/librustdoc/docfs.rs Outdated Show resolved Hide resolved
@GuillaumeGomez
Copy link
Member

Updated!

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 21, 2019
rbtcollins and others added 3 commits June 21, 2019 12:00
* Move fs::create_dir_all calls into DocFS to provide a clean
  extension point if async extension there is needed.
* Convert callsites of create_dir_all to ensure_dir to reduce syscalls.
* Convert fs::write usage to DocFS.write
  (which also removes a lot of try_err! usage for easier reading)
* Convert File::create calls to use Vec buffers and then DocFS.write
  in order to consistently reduce syscalls as well, make
  deferring to threads cleaner and avoid leaving dangling content if
  writing to existing files....
* Convert OpenOptions usage similarly - I could find no discussion on
  the use of create_new for that one output file vs all the other
  files render creates, if link redirection attacks are a concern
  DocFS will provide a good central point to introduce systematic
  create_new usage. (fs::write/File::create is vulnerable to link
  redirection attacks).
* DocFS::write defers to rayon for IO on Windows producing a modest
  speedup: before this patch on my development workstation:

$ time cargo +mystg1 doc -p winapi:0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 6m 11s

real    6m11.734s

Afterwards:
$ time cargo +mystg1 doc -p winapi:0.3.7
   Compiling winapi v0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 49.53s

real    0m49.643s

I haven't measured how much time is in the compilation logic vs in the
IO and outputting etc, but this takes it from frustating to tolerable
for me, at least for now.
@GuillaumeGomez
Copy link
Member

Weird considering that the rebase had no conflicts but whatever...

@GuillaumeGomez
Copy link
Member

@bors: r=rbtcollins,GuillaumeGomez

@bors
Copy link
Contributor

bors commented Jun 21, 2019

📌 Commit 65f1295 has been approved by rbtcollins,GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 21, 2019
Centril added a commit to Centril/rust that referenced this pull request Jun 21, 2019
…GuillaumeGomez

Add DocFS layer to rustdoc

* Move fs::create_dir_all calls into DocFS to provide a clean
  extension point if async extension there is needed.
* Convert callsites of create_dir_all to ensure_dir to reduce syscalls.
* Convert fs::write usage to DocFS.write
  (which also removes a lot of try_err! usage for easier reading)
* Convert File::create calls to use Vec buffers and then DocFS.write
  in order to both consistently reduce syscalls as well as make
  deferring to threads cleaner.
* Convert OpenOptions usage similarly - I could find no discussion on
  the use of create_new for that one output file vs all the other
  files render creates, if link redirection attacks are a concern
  DocFS will provide a good central point to introduce systematic
  create_new usage.
* DocFS::write defers to rayon for IO on Windows producing a modest
  speedup: before this patch on my development workstation:

$ time cargo +mystg1 doc -p winapi:0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 6m 11s

real    6m11.734s
user    0m0.015s
sys     0m0.000s

Afterwards:
$ time cargo +mystg1 doc -p winapi:0.3.7
   Compiling winapi v0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 49.53s

real    0m49.643s
user    0m0.000s
sys     0m0.015s

I haven't measured how much time is in the compilation logic vs in the
IO and outputting etc, but this takes it from frustating to tolerable
for me, at least for now.
Centril added a commit to Centril/rust that referenced this pull request Jun 21, 2019
…GuillaumeGomez

Add DocFS layer to rustdoc

* Move fs::create_dir_all calls into DocFS to provide a clean
  extension point if async extension there is needed.
* Convert callsites of create_dir_all to ensure_dir to reduce syscalls.
* Convert fs::write usage to DocFS.write
  (which also removes a lot of try_err! usage for easier reading)
* Convert File::create calls to use Vec buffers and then DocFS.write
  in order to both consistently reduce syscalls as well as make
  deferring to threads cleaner.
* Convert OpenOptions usage similarly - I could find no discussion on
  the use of create_new for that one output file vs all the other
  files render creates, if link redirection attacks are a concern
  DocFS will provide a good central point to introduce systematic
  create_new usage.
* DocFS::write defers to rayon for IO on Windows producing a modest
  speedup: before this patch on my development workstation:

$ time cargo +mystg1 doc -p winapi:0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 6m 11s

real    6m11.734s
user    0m0.015s
sys     0m0.000s

Afterwards:
$ time cargo +mystg1 doc -p winapi:0.3.7
   Compiling winapi v0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 49.53s

real    0m49.643s
user    0m0.000s
sys     0m0.015s

I haven't measured how much time is in the compilation logic vs in the
IO and outputting etc, but this takes it from frustating to tolerable
for me, at least for now.
Centril added a commit to Centril/rust that referenced this pull request Jun 21, 2019
…GuillaumeGomez

Add DocFS layer to rustdoc

* Move fs::create_dir_all calls into DocFS to provide a clean
  extension point if async extension there is needed.
* Convert callsites of create_dir_all to ensure_dir to reduce syscalls.
* Convert fs::write usage to DocFS.write
  (which also removes a lot of try_err! usage for easier reading)
* Convert File::create calls to use Vec buffers and then DocFS.write
  in order to both consistently reduce syscalls as well as make
  deferring to threads cleaner.
* Convert OpenOptions usage similarly - I could find no discussion on
  the use of create_new for that one output file vs all the other
  files render creates, if link redirection attacks are a concern
  DocFS will provide a good central point to introduce systematic
  create_new usage.
* DocFS::write defers to rayon for IO on Windows producing a modest
  speedup: before this patch on my development workstation:

$ time cargo +mystg1 doc -p winapi:0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 6m 11s

real    6m11.734s
user    0m0.015s
sys     0m0.000s

Afterwards:
$ time cargo +mystg1 doc -p winapi:0.3.7
   Compiling winapi v0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 49.53s

real    0m49.643s
user    0m0.000s
sys     0m0.015s

I haven't measured how much time is in the compilation logic vs in the
IO and outputting etc, but this takes it from frustating to tolerable
for me, at least for now.
bors added a commit that referenced this pull request Jun 22, 2019
Rollup of 9 pull requests

Successful merges:

 - #60971 (Add DocFS layer to rustdoc)
 - #61146 (SliceConcatExt::connect defaults to calling join)
 - #61181 (Fix theme-checker failure)
 - #61267 (rustc-book: Update the rustc/clang compatibility table for xLTO.)
 - #61270 (Remove warnings about incr. comp. generating less debugging output.)
 - #61681 (Changed the error message to more clearly explain what is allowed)
 - #61984 (More NodeId pruning)
 - #62016 (Add test for issue-27697)
 - #62019 (Remove needless lifetimes)

Failed merges:

r? @ghost
@bors
Copy link
Contributor

bors commented Jun 22, 2019

⌛ Testing commit 65f1295 with merge e562b24...

@bors bors merged commit 65f1295 into rust-lang:master Jun 22, 2019
@jyn514
Copy link
Member

jyn514 commented Aug 22, 2021

👋 @rbtcollins this is a really cool improvement - is there any reason you made it windows-only?

@rbtcollins
Copy link
Contributor Author

rbtcollins commented Aug 22, 2021 via email

@jyn514
Copy link
Member

jyn514 commented Aug 22, 2021

The current version in rustup with hard memory bounds and incremental
writes for the occasional very large file would be much more suitable for
unconditional use.

Oh, so there's an updated version of this in use by rustup? That seems useful :) rather than copying the code back and forth, would you be ok with having a repo in rust-lang both rustup and rustdoc use?

@rbtcollins
Copy link
Contributor Author

https://github.com/rust-lang/rustup/tree/master/src/diskio is what we have. Its not exactly the same interface, and never really was, as the solution put together for rustdoc. I'm entirely fine with work being done to make that usable by rustdoc, but:

  • we have limited bandwidth in rustup
  • this is due for another rewrite soon for async support
  • I don't want to have to wrangle too many cross-crate dependencies in working with this

So perhaps start by looking at what we have and see how well it fits with your needs - its not beautiful code to be honest; we hope that the next iteration, async based, with appropriate platform specific drivers (e.g. iouring(linux) + iocp(windows) + kqueue(mac)... will be lovely and clean, now we've learnt all the lessons we needed to.

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 16, 2021
rustdoc: reduce number of copies when using parallel IO

This is Windows-only for now; I was getting really bad slowdowns from this on linux for some reason.

Helps with rust-lang#82741. Follow-up to rust-lang#60971.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants