8000 fix: disable cutoff where it hurts concurrency by rgrinberg · Pull Request #7395 · ocaml/dune · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: disable cutoff where it hurts concurrency #7395

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Unreleased
----------

- Dune in watch mode no longer builds concurrent rules in serial (#7395
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes #5549 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll claim that we fixed it once we bring back cutoff without the penalty.

@rgrinberg, @jchavarri)

- `dune coq top` now correctly respects the project root when called from a
subdirectory. However, absolute filenames passed to `dune coq top` are no
longer supported (due to being buggy) (#7357, fixes #7344, @rlepigre and
Expand Down
10 changes: 10 additions & 0 deletions src/dune_config/config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,13 @@ let global_lock =
in
register t;
t

let cutoffs_that_reduce_concurrency_in_watch_mode =
let t =
{ name = "cutoffs_that_reduce_concurrency_in_watch_mode"
; of_string = Toggle.of_string
; value = `Disabled
}
in
register t;
t
4 changes: 4 additions & 0 deletions src/dune_config/config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ val get : 'a t -> 'a
(** should dune acquire the global lock before building *)
val global_lock : Toggle.t t

(** whether dune should add cutoff to various memoized functions where it
reduces concurrency *)
val cutoffs_that_reduce_concurrency_in_watch_mode : Toggle.t t

(** Before any configuration value is accessed, this function must be called
with all the configuration values from the relevant config file
([dune-workspace], or [dune-config]).
Expand Down
20 changes: 14 additions & 6 deletions src/dune_engine/build_system.ml
8000
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ and Exported : sig
(* The below two definitions are useless, but if we remove them we get an
"Undefined_recursive_module" exception. *)

val build_file_memo : (Path.t, Digest.t * target_kind) Memo.Table.t
val build_file_memo : (Path.t, Digest.t * target_kind) Memo.Table.t Lazy.t
[@@warning "-32"]

val build_alias_memo : (Alias.t, Dep.Fact.Files.t) Memo.Table.t
Expand Down Expand Up @@ -1035,13 +1035,21 @@ end = struct
end

let build_file_memo =
let cutoff = Tuple.T2.equal Digest.equal target_kind_equal in
Memo.create "build-file" ~input:(module Path) ~cutoff build_file_impl

let build_file path = Memo.exec build_file_memo path >>| fst
lazy
(let cutoff =
match
Dune_config.Config.(
get cutoffs_that_reduce_concurrency_in_watch_mode)
with
| `Disabled -> None
| `Enabled -> Some (Tuple.T2.equal Digest.equal target_kind_equal)
in
Memo.create "build-file" ~input:(module Path) ?cutoff build_file_impl)

let build_file path = Memo.exec (Lazy.force build_file_memo) path >>| fst

let build_dir path =
let+ digest, kind = Memo.exec build_file_memo path in
let+ digest, kind = Memo.exec (Lazy.force build_file_memo) path in
match kind with
| Dir_target { generated_file_digests } -> (digest, generated_file_digests)
| File_target ->
Expand Down
1 change: 1 addition & 0 deletions src/dune_engine/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
unix
csexp
stdune
dune_config
dune_console
dyn
fiber
Expand Down
0