File tree 4 files changed +29
-1
lines changed
4 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,5 @@ RUN install ./opam /usr/local/bin/
14
14
USER opam
15
15
RUN opam init --bare -n --disable-sandboxing /rep/opam-repository
16
16
RUN opam switch create --fake default 4.14.0
17
+ RUN opam list --all -s --all-versions > /home/opam/all-packages
17
18
RUN find /rep/opam-repository -name opam -type f > /home/opam/all-opam-files
Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ users)
119
119
120
120
## Benchmarks
121
121
* Make the benchmark setup process faster and the benchmark itself more stable [ #6094 @kit-ty-kate ]
122
+ * Add a benchmark showing the current performance of OpamVersionCompare [ #6078 @kit-ty-kate ]
122
123
123
124
## Reftests
124
125
### Tests
Original file line number Diff line number Diff line change @@ -63,6 +63,26 @@ let () =
63
63
launch (fmt " %s install -y --fake core.v0.15.0" bin);
64
64
time_cmd ~exit: 0 (fmt " %s install --show --deps-only core.v0.15.0" bin)
65
65
in
66
+ let time_OpamPackage_Version_compare_100 =
67
+ (* NOTE: https://github.com/ocaml/opam/pull/5518 *)
68
+ Gc. compact () ;
69
+ let ic = Stdlib. open_in_bin " /home/opam/all-packages" in
70
+ let pkgs =
71
+ let rec loop pkgs =
72
+ match Stdlib. input_line ic with
73
+ | pkg -> loop (OpamPackage. version (OpamPackage. of_string pkg) :: pkgs)
74
+ | exception End_of_file -> pkgs
75
+ in
76
+ loop []
77
+ in
78
+ let n = 100 in
79
+ let l = List. init n (fun _ ->
80
+ let before = Unix. gettimeofday () in
81
+ let _ = List. stable_sort OpamPackage.Version. compare pkgs in
82
+ Unix. gettimeofday () -. before)
83
+ in
84
+ List. fold_left (+. ) 0.0 l /. float_of_int n
85
+ in
66
86
let json = fmt {| {
67
87
" results" : [
68
88
{
@@ -92,6 +112,11 @@ let () =
92
112
" name" : " Deps-only install of an already installed package" ,
93
113
" value" : % f,
94
114
" units" : " secs"
115
+ },
116
+ {
117
+ " name" : " OpamPackage.Version.compare amortised over 100 runs" ,
118
+ " value" : % f,
119
+ " units" : " secs"
95
120
}
96
121
]
97
122
},
@@ -112,6 +137,7 @@ let () =
112
137
time_install_cmd_w_invariant
113
138
time_OpamSystem_read_100
114
139
time_deps_only_installed_pkg
140
+ time_OpamPackage_Version_compare_100
115
141
bin_size
116
142
in
117
143
print_endline json
Original file line number Diff line number Diff line change 1
1
(executable
2
2
(name bench)
3
- (libraries unix opam-core))
3
+ (libraries unix opam-core opam-format ))
You can’t perform that action at this time.
0 commit comments