Thanks for starting this conversation Marcel!
It seems that we do need a "proper" worker to take advantage of these strategies (which I didn't even know about!).
I think there are some orthogonal points you are raising and I just want to point them out:
1. Let's add worker support for rustc.
2. Let's make it bootstrapped.
3. Let's fold the functionality into process-wrapper, instead of a separate binary.
4. Let's make it use JSON.
5. Let's make it multi-threaded.
It might be more effective to pursue them one at a time :)
Point 2 - There is already a rust implementation of the worker in
https://github.com/bazelbuild/rules_rust/pull/421 and you could definitely use it as the thing to bootstrap from. It relied on pre-built binaries because I did not want to deal with bootstrapping. However, I don't see the value in spending effort bootstrapping it apart from "now it is in Rust" :) However, this is open source after all and we are all contributing because we enjoy it, so do what you want :)
Point 3 - Yes this is definitely something that should be done in the long term. I have avoided doing it in both #421 and #667 because having a separate process was far easier to prototype things and not break the non-worker part. However, 2 process spawns are certainly less efficient than 1, particularly on Windows where process execution is considerably slower [1]. It should be pretty easy to move everything into one binary and support both modes of execution (worker binaries should support execution as non-workers).
Point 4 - I don't have strong opinions on this. protobufs are easier in C++ because the rules_rust toolchain already has it set up, whereas json will require pulling in some other lib. Plus they are strongly typed, but that doesn't matter so much for the current protocol. In a pure-Rust worker, you would need to pull in a library either way and solve the bootstrap problem.
Point 5 - Re: Windows processes, this may actually make things even faster on Windows iff Bazel is smart enough to prefer threads over processes when a worker supports it.
So #1 is enough to get you going on your dynamic strategy test. #3 and #5 are potential performance improvements. #4 is entirely a matter of preference. #2 seems mostly like a nice-to-have to me.
I don't think I'll be investing more dedicated time into rules_rust as I'm starting a new job soon that will not involve Rust. However I am really interested in pushing Bazel wherever possible, even though Cargo is entrenched in the Rust ecosystem, and would be delighted to see things that make it less of a compromise (i.e. missing incremental builds). Please feel free to drive this if you have the resources! Thanks again.