Appreciable compilation slowdown with Sync + Send markers

@huon

This is a case of O(2^n). I know what the issue is, at least in my minified case.

Thatā€™s great and I hope your knowledge helps improve performance, however my comment was directed to @DenisKolodin, providing some (hopefully reusable) tips/tools for poking around in the compiler.

Thank you! It's very useful to me. Also I've never listen about DXR before :+1:

@huon could you prompt me the handy tool to explore how Rust compiler works inside? I use GDB in terminal, but it's hard to steps through the code. Internal data exploration is tangled. What tool do you use to work with running code? I dream about something like Visual Studio :blush: But I admit that another tools can also be handy.

Iā€™m not sure the best way to track that sort of thing. Personally I use the logging statements that are inside it, e.g. RUST_LOG=rustc::middle::traits rustc ... will cause debug! and info! statements inside that module to print during that invocation. I believe getting debug! statements to print requires compiling a compiler manually, passing --enable-debug-assertions to ./configure. (The compilerā€™s RUST_LOG is similar to that in the external env_logger crate, but possibly not 100% identical.)

gdb will also work better if you build the compiler yourself and pass --enable-debuginfo to ./configure. I believe one can pass both --enable-debug-assertions and --enable-debuginfo with the --enable-debug flag, but youā€™ll probably want to also pass --enable-optimize to avoid getting a horribly slow compiler. Also, thereā€™s been some unreliabilities with using a debugger on the compiler (and/or with building a compiler for a debugger) in the past, which may still exist.

(./configure accepts --help, so you donā€™t have to remember all the details about the various flags.)

2 Likes

I had no idea that there are more debug options! Thanks for your tips. Itā€™s useful to me.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.