Skip to content
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

perf: dfx build slow due to moc-wrapper #222

Closed
crusso opened this issue Apr 8, 2024 · 2 comments · Fixed by #223
Closed

perf: dfx build slow due to moc-wrapper #222

crusso opened this issue Apr 8, 2024 · 2 comments · Fixed by #223
Labels

Comments

@crusso
Copy link

crusso commented Apr 8, 2024

I've noticed that utilizing the DFX_MOC_PATH=moc-wrapper indirection to select a particular moc binary, though convenient, can drastically slow down builds using dfx.

The problem is that dfx actually invokes moc repeatedly to determine the dependencies of a motoko project, not just once. On my machine, calling moc indirectly through moc-wrapper is about 50x slower than calling a particular moc binary.

See dfinity/sdk#3699 for an example.

Once we've determined which binary to use, the overhead can be avoided by re-defining DFX_MOC_PATH accordingly so there is a manual workaround, but it causes friction.

@ZenVoich can you think of any way to fix this? Is there a clean and safe way to cache the result?

@ZenVoich
Copy link
Owner

Optimized moc-wrapper to cache moc path to a file. So it will not run nodejs every time.

For mops canister, speed up is ~30%, 25s -> 18s

@ZenVoich
Copy link
Owner

Released in 0.44.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants