The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove use of notty for formatting benchmark results

It prevents uring from being tested on OCaml 5.

+65 -38
+44
bench/bechamel_csv/bechamel_csv.ml
··· 1 + open Bechamel 2 + 3 + let pad width v = 4 + let padding = String.make (width - String.length v) ' ' in 5 + padding ^ v 6 + 7 + let pp_row ~width f data = 8 + data |> List.iteri (fun i v -> 9 + if i > 0 then Fmt.comma f (); 10 + Fmt.pf f "%s" (pad width.(i) v) 11 + ) 12 + 13 + let pp f results = 14 + let results = Hashtbl.to_seq results |> Array.of_seq in 15 + Array.sort (fun (n1, _) (n2, _) -> String.compare n1 n2) results; (* Sort columns *) 16 + let rows = snd results.(0) |> Hashtbl.to_seq |> Seq.map fst |> Array.of_seq in 17 + let width = Array.make (Array.length results + 1) 0 in 18 + width.(0) <- String.length "name, "; 19 + results |> Array.iteri (fun i (name, _) -> width.(i + 1) <- String.length name + 2); 20 + Array.sort String.compare rows; 21 + let rows = 22 + rows |> Array.map (fun name -> 23 + width.(0) <- max width.(0) (String.length name + 2); 24 + let values = 25 + results |> Array.mapi (fun i (_, col) -> 26 + let v = 27 + match Hashtbl.find col name |> Analyze.OLS.estimates with 28 + | Some [v] -> Printf.sprintf "%f" v 29 + | _ -> assert false 30 + in 31 + width.(i + 1) <- max width.(i + 1) (String.length v + 2); 32 + v 33 + ) 34 + in 35 + name, values 36 + ) 37 + in 38 + let metrics = Array.to_list results |> List.map fst in 39 + let headings = List.mapi (fun i v -> pad width.(i) v) ("name" :: metrics) in 40 + Fmt.pf f "@[<v>@[<h>%a@]" Fmt.(list ~sep:comma string) headings; 41 + rows |> Array.iter (fun (name, data) -> 42 + Fmt.pf f "@,@[<h>%a@]" (pp_row ~width) (name :: Array.to_list data); 43 + ); 44 + Fmt.pf f "@]"
+2
bench/bechamel_csv/bechamel_csv.mli
··· 1 + val pp : (string, (string, Bechamel.Analyze.OLS.t) Stdlib.Hashtbl.t) Stdlib.Hashtbl.t Fmt.t 2 + (** [pp] formats the results of {!Bechamel.Analyze.merge} as a CSV table. *)
+3
bench/bechamel_csv/dune
··· 1 + (library 2 + (name bechamel_csv) 3 + (libraries bechamel fmt))
+12 -1
bench/dune
··· 1 1 (executable 2 2 (name main) 3 3 (modules main) 4 - (libraries uring bechamel bechamel-notty notty.unix)) 4 + (libraries uring bechamel bechamel_csv)) 5 5 6 6 (executable 7 7 (name readv) 8 8 (modules readv) 9 9 (libraries uring)) 10 + 11 + (executable 12 + (name cptest) 13 + (modules cptest) 14 + (libraries urcp_fixed_lib urcp_lib lwtcp_lib uring bechamel bechamel_csv)) 15 + 16 + (rule 17 + (alias runbenchmark) 18 + (package uring) 19 + (action 20 + (run ./cptest.exe)))
+2 -10
bench/main.ml
··· 31 31 List.map (fun i -> Analyze.all ols i raw_results) metrics 32 32 |> Analyze.merge ols metrics 33 33 34 - let rect = 35 - match Notty_unix.winsize Unix.stdout with 36 - | Some (w, h) -> { Bechamel_notty.w; h } 37 - | None -> { Bechamel_notty.w = 80; h = 1 } 38 - 39 34 let () = 40 - List.iter (fun v -> Bechamel_notty.Unit.add v (Measure.unit v)) metrics; 41 - benchmark () 42 - |> Bechamel_notty.Multiple.image_of_ols_results ~rect ~predictor:Measure.run 43 - |> Notty_unix.eol 44 - |> Notty_unix.output_image 35 + let results = benchmark () in 36 + Fmt.pr "@[<v>%a@]@." Bechamel_csv.pp results
-2
dune-project
··· 17 17 (ocaml (>= 4.12.0)) 18 18 dune-configurator 19 19 (lwt (and :with-test (>= 5.0.0))) 20 - (notty (and (>= 0.2.2) :with-test)) 21 - (bechamel-notty (and (>= 0.1.0) :with-test)) 22 20 (bechamel (and (>= 0.1.0) :with-test)) 23 21 (logs (and :with-test (>= 0.5.0))) 24 22 (cmdliner (and :with-test (>= 1.1.0)))
+1 -16
tests/cptest.ml bench/cptest.ml
··· 73 73 (results, raw_results) 74 74 75 75 let () = 76 - List.iter 77 - (fun v -> Bechamel_notty.Unit.add v (Measure.unit v)) 78 - Instance.[ minor_allocated; major_allocated; monotonic_clock ] 79 - 80 - let img (window, results) = 81 - Bechamel_notty.Multiple.image_of_ols_results ~rect:window 82 - ~predictor:Measure.run results 83 - 84 - open Notty_unix 85 - 86 - let () = 87 - let window = 88 - match winsize Unix.stdout with 89 - | Some (w, h) -> { Bechamel_notty.w; h } 90 - | None -> { Bechamel_notty.w = 80; h = 1 } in 91 76 let results, _ = benchmark () in 92 - img (window, results) |> eol |> output_image 77 + Fmt.pr "%a@." Bechamel_csv.pp results
+1 -7
tests/dune
··· 34 34 (modules poll_add) 35 35 (libraries unix uring logs logs.fmt)) 36 36 37 - (executable 38 - (name cptest) 39 - (modules cptest) 40 - (libraries urcp_fixed_lib urcp_lib lwtcp_lib uring bechamel notty.unix 41 - bechamel-notty)) 42 - 43 37 (rule 44 38 (alias runtest) 45 39 (package uring) ··· 50 44 (package uring) 51 45 (deps urcp.exe) 52 46 (action 53 - (run ./cptest.exe ./urcp.exe))) 47 + (run ./urcp.exe))) 54 48 55 49 (mdx 56 50 (deps (package uring)))
-2
uring.opam
··· 15 15 "ocaml" {>= "4.12.0"} 16 16 "dune-configurator" 17 17 "lwt" {with-test & >= "5.0.0"} 18 - "notty" {>= "0.2.2" & with-test} 19 - "bechamel-notty" {>= "0.1.0" & with-test} 20 18 "bechamel" {>= "0.1.0" & with-test} 21 19 "logs" {with-test & >= "0.5.0"} 22 20 "cmdliner" {with-test & >= "1.1.0"}