File tree 4 files changed +26
-1
lines changed
4 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,4 @@ RUN git clone https://github.com/ocaml/opam-repository --depth 1
13
13
RUN git -C opam-repository fetch origin $OPAMREPOSHA
14
14
RUN git -C opam-repository checkout $OPAMREPOSHA
15
15
RUN opam init -n --disable-sandboxing ./opam-repository
16
+ RUN find "$(pwd)/opam-repository" -name opam -type f > /home/opam/all-opam-files
Original file line number Diff line number Diff line change @@ -131,6 +131,9 @@ users)
131
131
132
132
## Test
133
133
134
+ ## Benchmarks
135
+ * Benchmark OpamSystem.read [ #5900 @kit-ty-kate ]
136
+
134
137
## Reftests
135
138
### Tests
136
139
* Add init scripts tests [ #5864 @rjbou ]
Original file line number Diff line number Diff line change @@ -33,6 +33,21 @@ let () =
33
33
launch " opam switch set-invariant core -n --sw two" ;
34
34
time_cmd ~exit: 0 (fmt " %s install magic-trace -y --fake --sw two" bin)
35
35
in
36
+ let time_OpamSystem_read_10 =
37
+ let time_OpamSystem_read () =
38
+ let ic = Stdlib. open_in_bin " /home/opam/all-opam-files" in
39
+ let before = Unix. gettimeofday () in
40
+ let rec loop () =
41
+ match Stdlib. input_line ic with
42
+ | file -> ignore (OpamSystem. read file); loop ()
43
+ | exception End_of_file -> Unix. gettimeofday () -. before
44
+ in
45
+ loop ()
46
+ in
47
+ let n = 10 in
48
+ let l = List. init n (fun _ -> time_OpamSystem_read () ) in
49
+ List. fold_left (+. ) 0.0 l /. float_of_int n
50
+ in
36
51
let json = fmt {| {
37
52
" results" : [
38
53
{
@@ -52,6 +67,11 @@ let () =
52
67
" name" : " Fake install with invariant" ,
53
68
" value" : % f,
54
69
" units" : " secs"
70
+ },
71
+ {
72
+ " name" : " OpamSystem.read amortised over 10 runs" ,
73
+ " value" : % f,
74
+ " units" : " secs"
55
75
}
56
76
]
57
77
},
@@ -70,6 +90,7 @@ let () =
70
90
time_misspelled_cmd
71
91
time_install_cmd
72
92
time_install_cmd_w_invariant
93
+ time_OpamSystem_read_10
73
94
bin_size
74
95
in
75
96
print_endline json
Original file line number Diff line number Diff line change 1
1
(executable
2
2
(name bench)
3
- (libraries unix))
3
+ (libraries unix opam-core ))
You can’t perform that action at this time.
0 commit comments