From 8794f54bca6ad50ca63b828b4ffde76cf7979575 Mon Sep 17 00:00:00 2001
From: Paul-Elliot <peada@free.fr>
Date: Fri, 29 Sep 2023 12:49:51 +0200
Subject: [PATCH 1/3] benchmark: review comments

- Make multiple runs of benchmark actually run.
- Fix non-existent driver-benchmarks.json by adopting a simpler
  approach: instead of outputing in a file, then promoting, then running
  `cat`, we just output in the standard output.

Signed-off-by: Paul-Elliot <peada@free.fr>
---
 Makefile | 7 +------
 doc/dune | 7 ++-----
 dune     | 2 +-
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 012a281927..53447dc270 100644
--- a/Makefile
+++ b/Makefile
@@ -13,14 +13,9 @@ publish-docs:
 test :
 	dune runtest
 
-# Echo is disabled as the benchmarks results are printed on stdout.
-# '@bench' exit status is not checked as it's very likely to fail due to
-# needing promotion rather than because it really failed.
 .PHONY : bench
 bench:
-	-@dune build @bench
-	@dune promote driver-benchmarks.json
-	@cat driver-benchmarks.json
+	@dune build @bench
 
 .PHONY : coverage
 coverage :
diff --git a/doc/dune b/doc/dune
index f960badaf8..ba464383de 100644
--- a/doc/dune
+++ b/doc/dune
@@ -31,15 +31,12 @@
   (> %{ocaml_version} 4.11))
  (deps
   (package odoc)
+  (universe) ; Benchmark depends on the running programs in the background
   (glob_files *.mld)
   (glob_files library_mlds/*)
   (glob_files examples/*.ml*))
  (action
-  (progn
-   ; Make sure the benchmark result is created as Dune would not show the diff
-   ; if the script failed before creating it.
-   (write-file driver-benchmarks.json "")
-   (run ocaml-mdx-test --force-output %{dep:driver.mld}))))
+   (run ocaml-mdx-test --force-output %{dep:driver.mld})))
 
 (rule
  (alias docgen)
diff --git a/dune b/dune
index d30ceee584..2211e9997a 100644
--- a/dune
+++ b/dune
@@ -12,4 +12,4 @@
 (rule
  (alias bench)
  (action
-  (diff driver-benchmarks.json doc/driver-benchmarks.json)))
+  (cat doc/driver-benchmarks.json)))

From 56c3883b28c6c28466b7ed07b0e884d0242a5048 Mon Sep 17 00:00:00 2001
From: Paul-Elliot <peada@free.fr>
Date: Fri, 29 Sep 2023 12:55:03 +0200
Subject: [PATCH 2/3] Driver: make it deterministic again

Signed-off-by: Paul-Elliot <peada@free.fr>
---
 doc/driver.mld | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/driver.mld b/doc/driver.mld
index 012622ba48..d9040b3b40 100644
--- a/doc/driver.mld
+++ b/doc/driver.mld
@@ -789,11 +789,11 @@ If needed, the list of commands executed so far can be shown by de-commenting th
 # (* List.iter print_cmd (List.rev !commands);; *)
 ]}
 
-Print the slowest commands for each subcommands:
+If needed, the list of the slowest commands for each subcommands can be shown by de-commenting this block:
 (for the record, these commands are run from directory `_build/default/doc`)
 
 {[
-# List.iter print_cmd (k_longest_commands "compile" 5)
+# (* List.iter print_cmd (k_longest_commands "compile" 5) *)
 # (* List.iter print_cmd (k_longest_commands "link" 5) *)
 # (* List.iter print_cmd (k_longest_commands "html-generate" 5) *)
 ]}

From bd270fc564829316de899b3e823ab9e99f43b9d6 Mon Sep 17 00:00:00 2001
From: panglesd <peada@free.fr>
Date: Fri, 29 Sep 2023 14:28:24 +0200
Subject: [PATCH 3/3] Improve comment on benchmark dependency

Co-authored-by: Jules Aguillon <jules@j3s.fr>
---
 doc/dune | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/dune b/doc/dune
index ba464383de..b24481dfa1 100644
--- a/doc/dune
+++ b/doc/dune
@@ -31,7 +31,7 @@
   (> %{ocaml_version} 4.11))
  (deps
   (package odoc)
-  (universe) ; Benchmark depends on the running programs in the background
+  (universe) ; Benchmark depends on the running time of odoc commands
   (glob_files *.mld)
   (glob_files library_mlds/*)
   (glob_files examples/*.ml*))