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

dune exec --no-build is slow #10503

Open
Khady opened this issue May 10, 2024 · 5 comments
Open

dune exec --no-build is slow #10503

Khady opened this issue May 10, 2024 · 5 comments

Comments

@Khady
Copy link
Contributor

Khady commented May 10, 2024

Expected Behavior

dune exec --no-build or dune exec when there's nothing to build should be almost as fast as launched the binary manually

Actual Behavior

Even with --no-build and a path to the binary (no need to look up for a name), dune can be 40 times slower than just launching the bin by hand

$ time dune exec ./bin/main.exe --no-build -- --version

real	0m0.655s
user	0m0.474s
sys	0m0.170s
$ time _build/default/bin/main.exe --version

real	0m0.015s
user	0m0.007s
sys	0m0.007s

The cost seems to grow higher as the binary and project gets bigger. strace shows A LOT of activity.

Reproduction

Can't open source the specific case, but any open source project can highlight this behavior

git clone https://github.com/ahrefs/atd.git
cd atd
# setup ocam libs
time dune exec --no-build atdgen/bin/ag_main.exe -- -version
time _build/default/atdgen/bin/ag_main.exe -version

Specifications

  • Version of dune (output of dune --version): 3.15
  • Version of ocaml (output of ocamlc --version): 4.14.0
  • Operating system (distribution and version): debian bullseye
@rgrinberg
Copy link
Member

I don't know if there's much we can do. We need to load the rules in a directory to see if the executable exists. That's probably where the overhead comes from.

@Khady
Copy link
Contributor Author

Khady commented May 11, 2024

Couldn’t we have some shortcuts, such as checking the presence of the binary in _build before to load all the rules?

@rgrinberg
Copy link
Member

It wouldn't be a valid optimization. The rules can change between runs and the stale artifact would remain.

@Khady
Copy link
Contributor Author

Khady commented May 12, 2024

Which would happen with --no-build anyway?

@rgrinberg
Copy link
Member

It would not. Re-loading the rules will clear stale artifacts.

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

No branches or pull requests

2 participants