-
Notifications
You must be signed in to change notification settings - Fork 401
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
Add monorepo benchmark #7202
Add monorepo benchmark #7202
Conversation
Would it be possible to move monorepo-bench to bench/monorepo? |
monorepo-bench/dune
Outdated
(modules bench) | ||
(libraries unix)) | ||
|
||
(library |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this mega library? It's not enough to build everything individually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The monorepo is made up of many packages and some of them contain libraries that don't build. I've made a list of the libraries that don't build and used them to construct the list of libraries in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean don't build? As in fail to build, or aren't being requested to build at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean that they fail to build in a monorepo setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So building this mega library is supposed to fail as well then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the list of libraries in this file are just the ones that build in a monorepo setting.
monorepo-bench/Makefile
Outdated
$(RUNNER): dune bench.ml | ||
dune build $@ --release | ||
|
||
bench: $(RUNNER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this depend on $(DUNE_TO_BENCHMARK)
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. $(DUNE_TO_BENCHMARK)
isn't a target of this makefile; it's assumed that it's already been built when make bench
is run.
dune
Outdated
@@ -0,0 +1 @@ | |||
(data_only_dirs monorepo-bench) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this works since we have a top level dune-file instead. In any case, I'd like to see this under bench/ if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you're right, even with this file when I run dune build
it attempts to build the project in monorepo-bench. I'll move the monorepo benchmark inside the "bench" directory but I still need to find a way to prevent the monorepo bench project being seen by dune. My intention is that it should only ever be built inside a docker container when running the benchmark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could exclude it with (dirs ..)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up moving the monorepo-bench dir to bench/monorepo and adding (dirs :standard \ monorepo)
to bench/dune. I don't understand why (dirs ..)
works. Did you mean that putting (dirs ..)
in a dune file would exclude that file's directory from the build? Why is it necessary to refer to the parent directory?
I've moved the monorepo benchmark to bench/monorepo and fixed the dune files so it's excluded from normal builds. As an experiment I tried getting rid of the |
Which command did you try? |
I tried running |
How annoying. I really regret adding all this special behavior to vendored directories. We can either:
Your choice. |
I'm going to elect to keep things as they are (I'll update this PR with a note explaining why) as some libraries don't build in a monorepo setting, so without the specific list of libraries to build we would have to remove packages so that every library in every remaining package builds in a monorepo setting. |
After discussing this with @snowleopard I'm moving most of this benchmark to a separate repo (currently https://github.com/gridbugs/ocaml-monorepo-benchmark/tree/main/benchmark but the plan is to move it to https://github.com/ocaml-dune). I'll keep the bench.Dockerfile and benchmark runner tool in this PR and update the dockerfile to download the rest of the benchmark from its external location. The reasoning behind this is to avoid adding the ~1mb opam-monorepo lockfile to dune, consolidating the benchmarks with the tool that generates the benchmarks (also in the ocmal-monorepo-benchmark repo) and so that the monorepo can be used for non-dune purposes in the future. |
4b8a963
to
3b72eff
Compare
To add one more reason: I think it's worth planning to have more than one monorepo benchmark in future, and pushing all of them to the Dune repo doesn't seem right. |
6aa01af
to
9a1186b
Compare
I've moved all the files specific to the content of the benchmark to https://github.com/ocaml-dune/ocaml-monorepo-benchmark and made a tag of that repo |
@rgrinberg regarding the dune file listing all the library dependencies, I've moved it to the ocaml-monorepo-benchmark repo (here https://github.com/ocaml-dune/ocaml-monorepo-benchmark/blob/main/benchmark/dune). I've also added to that repo a description of why the file is necessary, in https://github.com/ocaml-dune/ocaml-monorepo-benchmark/blob/main/benchmark/README.md. Are there any other changes needed before we merge this? |
This adds a current-bench benchmark that measures the time it takes to build a large monorepo composed from opam packages. Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
9a1186b
to
77f2c93
Compare
Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
3d95de5
to
944d134
Compare
@gridbugs Could you add a note in the benchmark section of hacking.rst how to use this? |
This adds a current-bench benchmark that measures the time it takes to build a large monorepo composed from opam packages.