-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
A minimal rebuild of pdb-downloader takes too long #47240
Comments
Is this the project? https://github.com/jrmuizel/pdb-downloader/ |
Ah yes, sorry. I meant to include that link in the original report. |
Looks to me like over half the time is spent on running the linker. Which doesn't surprise me, the dependencies are huge! In a debug-build, goblin is a 17MB rlib, indicativ is a 6.2MB rlib, and reqwest is a 28MB rlib. I'm guessing your compile times wouldn't be must better in C or C++. If rust/cargo had better support for dynamic linking it might go a lot faster. |
Some local timings:
Opening up a profiler I see
|
Given the object files should still be in place is it possible for us to avoid having to run dsymutil? |
So I, personally, actually have no idea why we run dsymutil. I did a bit of digging to find out and I've never blamed a line of code so far back at this one in Rust's history. Turns out 196351aa introduced it, and as with many lines of code written seven (!) years ago it's changed a lot since then and unfortunately doesn't have a ton of rationale for why it exists (hey one can hope can't he?). That being said a little testing locally makes it pretty obvious as to why it exists. At least lldb doesn't work without it! Or at least for me if I deleted the Despite that though I still have very little idea what dsymutil is doing. For example are there options we can compile with to make it take less time? Options to dsymutil? Something like My guess is that we can't not run dsymutil if we want up-to-date debug information, but I could be wrong! With all the work being done it seems unlikely at least that lldb is going back to the original objects. All that being said surely C++ runs into similar problems here. Or maybe we generate more debuginfo? Or maybe the executable here is too big? Unsure :( |
Interesting though! So rustc deletes object files that go into rlibs, basically cleaning up after itself. If we don't do that, however, then And then even more interestingly! It turns out that if I delete the So debugging a binary doesn't actually work because the object files for the binary are cleaned up and deleted by rustc. Debugging a library of a binary works though because the rlib is still on the filesystem after the build. It seems odd to try to change course with
I believe that means that we wouldn't run Now emitting object files from rustc by default is pretty tricky. Mostly in that we've never done it before and it's not clear if people want object files getting jettisoned out. What I think we could do though is not change rustc's defaults but change Cargo's defaults. For example we could have a flag to rustc like @michaelwoerister curious what you think about this! I feel like it'd actually be pretty nice to not have to run |
Yeah, we don't run dsymutil on the c++ part of Firefox builds because we still have all of the object files around. |
Keeping object files around would also help on Linux where we could use debuginfo fission to speed up linking. The same approach might be possible on OS X. |
Yes, you're exactly correct. Apple's toolchain does the equivalent of dsymutil is still useful because most other tools do not know how to locate the debug symbols from the object files, so people who want to run things like profilers or whatnot will probably need this step. It's not particularly onerous to tell people that they have to run Just as an aside, dsymutil takes forever to run on Firefox's libxul. We don't run it as part of the normal build, but we run it as a post-build step so we can upload the dSYM to our symbol server and also so we can run our dump_syms tool on it to get symbols in Breakpad format for our crash reports. If we ever get to a point where we let cargo build libxul we'd definitely want this fixed! |
FWIW, Instruments does not need you to run dysmutil to profile Firefox. I'm not sure what tools do. |
I've got an initial pass for adding an option to not run dsymutil at #47784, and once that lands I plan to update Cargo to by default not run dsymutil |
This commit adds the ability for rustc to not run `dsymutil` by default on OSX. A new codegen option, `-Z run-dsymutil=no`, was added to specify that `dsymutil` should *not* run and instead the compiler should unconditionally keep the object files around in a compilation if necessary for debug information. cc rust-lang#47240
…elwoerister rustc: Add the ability to not run dsymutil This commit adds the ability for rustc to not run `dsymutil` by default on OSX. A new codegen option, `-Z run-dsymutil=no`, was added to specify that `dsymutil` should *not* run and instead the compiler should unconditionally keep the object files around in a compilation if necessary for debug information. cc rust-lang#47240
…elwoerister rustc: Add the ability to not run dsymutil This commit adds the ability for rustc to not run `dsymutil` by default on OSX. A new codegen option, `-Z run-dsymutil=no`, was added to specify that `dsymutil` should *not* run and instead the compiler should unconditionally keep the object files around in a compilation if necessary for debug information. cc rust-lang#47240
Is this fixed now, now that dsymutil is no longer run by default? |
A trivial rebuild takes 0.18s today on my Mac, and a from-scratch build including all dependencies takes ~3.13 seconds. I think this can be closed. |
On my MacBook Pro I see:
main.rs is only 90 lines
The text was updated successfully, but these errors were encountered: