`dfx build` is much slower than direct usage of `moc`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 204
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
First raised at https://forum.dfinity.org/t/why-is-dfx-build-much-slower-than-direct-usage-of-moc/29513
$ time moc --idl --stable-types `mops sources` -o ~/t/test.wasm stress-test/stresser.mo
...
|real|0m33.963s|
|---|---|
|user|0m33.733s|
|sys|0m0.367s|
but
$ time dfx build stresser
...
|real|0m51.280s|
|---|---|
|user|0m52.176s|
|sys|0m2.641s|
stresser canister has no dependencies.
So dfx build is nearly 2 times slower than plain moc invocation. Why? (I suspect that it builds also a wallet canister and is slow because of this.)
This needs to be fixed: dfx build should be faster (or provide flags to make it fast).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported moc and dfx build stresser timings, using mops sources and the dependency-free stresser canister described in the issue. Trace what dfx build does beyond the direct moc invocation, then verify that the unnecessary overhead is removed or that an equivalent fast-build option works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, cli, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100