Initial build takes a few minutes. Don't panic. Subsequent builds will be faster

When I deploy an application for the first time, I get this:

Initial build takes a few minutes. Don't panic. Subsequent builds will be faster.

What causes the initial build to take a few minutes compared to subsequent builds?

Based on this source code, it looks like it could be there is no cache to reference?

Searching for the string leads me to Azle, so I assume this is about building an Azle project. dfx itself doesn’t do any caching for canister builds, so this is all the responsibility of the canister’s build system. Azle is based on Rust, and initial builds in Rust do take quite a while. I assume this is a reference to that. Just to have some numbers: A typical cargo build of dfx during development takes ~7 seconds. cargo build after wiping all cached code just took me 108 seconds on a pretty beefy machine.

1 Like