twizzler-operating-system / twizzler

The Twizzler Operating System
BSD 3-Clause "New" or "Revised" License
66 stars 13 forks source link

Improve toolchain build times. #106

Closed PandaZ3D closed 1 year ago

PandaZ3D commented 1 year ago

Building Twizzler requires compiling all of LLVM and Rust.. We have to do this since we need to teach Rust/LLVM about Twizzler, and provide standard library support. After looking at config.toml I realized we can do a lot better.

The biggest improvement was only having LLVM not compile support for unnecessary targets. This resulted in ~25% improvement in from-scratch builds (cargo bootstrap) and ~66% improvement for rebuilds (cargo bootstrap --skip-submodules) on my machine.

We could get some other improvements, but I want people to weigh in on this:

That's all I found so far. Improving CI builds is a whole other topic :)

dbittman commented 1 year ago

I'm all for improving toolchain build times!

For the tools: do we need any of them? If we try to run clippy (might need support in xtask?), is the rustup-installed clippy usable?

Incremental: sounds good! This won't affect a fresh build, right? It'll still have to build all from scratch? If so, that's good.

PandaZ3D commented 1 year ago

For the tools: do we need any of them?

I don't honestly know. I will try to disable them and see what actually happens.

If we try to run clippy (might need support in xtask?), is the rustup-installed clippy usable?

I imagine the rustup installed clippy is usable, but we will see

Incremental: sounds good! This won't affect a fresh build, right? It'll still have to build all from scratch? If so, that's good.

Looks like I have a few tests to run. We will see how this affects from scratch builds.

PandaZ3D commented 1 year ago

I also realized that we could probably shallow clone the submodules. This would be faster since it does not have to download all of the git history. Testing this now.

PandaZ3D commented 1 year ago

So we are able to completely remove compilation of the tools. We just need to install the rust src in another step. Building code and running it in QEMU seems to work. No problems with clippy either, but we will see if it works on the CI machine (from scratch).

Incremental builds only helps out when building rustc. It makes a from scratch build slightly slower. We probably don't need this since we are not hacking the compiler, rather the standard library (via twizzler-abi).

PandaZ3D commented 1 year ago

Doing a shallow clone does speed up the submodule part of the bootstrap phase significantly. However, I believe there is a thing with shallow clones that makes pulling updates from submodules slower. But that might be ok for our purposes.