-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: add synthetic benchmark (#7189)
* perf: add synthetic benchmark Signed-off-by: Javier Chávarri <[email protected]>
- Loading branch information
Showing
4 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
(executable | ||
(name bench) | ||
(modules bench) | ||
(libraries dune_stats chrome_trace stdune fiber dune_engine dune_util)) | ||
|
||
(rule | ||
(alias bench) | ||
(action | ||
(run ./bench.exe %{bin:dune}))) | ||
|
||
(executable | ||
(modules gen_synthetic) | ||
(libraries unix) | ||
(name gen_synthetic)) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
open Printf | ||
|
||
let write_modules basedir num_modules = | ||
for current_mod = 1 to num_modules do | ||
let modname = sprintf "%s/m_%d" basedir current_mod in | ||
let f = open_out (sprintf "%s.ml" modname) in | ||
close_out f | ||
done | ||
|
||
let dune = {| | ||
(library | ||
(name test)) | ||
|} | ||
|
||
let write basedir = | ||
let () = Unix.mkdir basedir 0o777 in | ||
let f = open_out (Filename.concat basedir "dune") in | ||
output_string f dune; | ||
let () = close_out f in | ||
write_modules basedir | ||
|
||
let () = | ||
let basedir = ref "." in | ||
let num_modules = ref 0 in | ||
Arg.parse | ||
[ ( "-n" | ||
, Arg.Int (fun n -> num_modules := n) | ||
, "<n> number of modules to include in the synthetic library" ) | ||
] | ||
(fun d -> basedir := d) | ||
(sprintf "usage: %s [basedir]" (Filename.basename Sys.argv.(0))); | ||
|
||
write !basedir !num_modules |