Skip to content

Commit 454150b

Browse files
authored
flambda-backend: Speed up testsuite (oxcaml#658)
1 parent 8362f9e commit 454150b

23 files changed

Lines changed: 126 additions & 109 deletions

File tree

testsuite/tests/basic/tailcalls.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,21 @@ let rec tailcall16_value_closures a b c d e f g h i j k l m n o p =
7272
and fs = [tailcall16_value_closures]
7373

7474
let _ =
75-
print_int (tailcall4 10000000 0 0 0); print_newline();
76-
print_int (tailcall8 10000000 0 0 0 0 0 0 0); print_newline();
77-
print_int (tailcall16 10000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0);
75+
print_int (tailcall4 1000000 0 0 0); print_newline();
76+
print_int (tailcall8 1000000 0 0 0 0 0 0 0); print_newline();
77+
print_int (tailcall16 1000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0);
7878
print_newline();
79-
print_int (tailcall32 10000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
79+
print_int (tailcall32 1000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8080
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0);
8181
print_newline();
8282
print_int (indtailcall8 tailcall8 10 0 0 0 0 0 0 0); print_newline();
8383
print_int (indtailcall16 tailcall16 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0);
8484
print_newline();
85-
print_int (tailcall16_value_closures 10000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0);
85+
print_int (tailcall16_value_closures 1000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0);
8686
print_newline();
87-
print_int (muttailcall8 10000000 0 0 0 0 0 0 0); print_newline();
88-
print_int (muttailcall16 10000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0);
87+
print_int (muttailcall8 1000000 0 0 0 0 0 0 0); print_newline();
88+
print_int (muttailcall16 1000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0);
8989
print_newline();
90-
print_int (muttailcall32 10000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
90+
print_int (muttailcall32 1000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9191
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0);
9292
print_newline()
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
10000001
2-
10000001
3-
10000001
4-
10000001
1+
1000001
2+
1000001
3+
1000001
4+
1000001
55
11
66
11
7-
10000001
8-
10000001
9-
10000001
10-
10000001
7+
1000001
8+
1000001
9+
1000001
10+
1000001

testsuite/tests/lib-dynlink-native/main.ml

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,186 +13,186 @@ set subdir = "${test_source_directory}/sub"
1313
1414
** native-dynlink
1515
libraries = "" (* We will add them manually where appropriated *)
16-
*** setup-ocamlopt.byte-build-env
16+
*** setup-ocamlopt.opt-build-env
1717
ocamlopt_default_flags = "" (* Removes the -ccopt -no-pie on ised on OpenBSD *)
1818
**** script
1919
script = "mkdir sub"
2020
***** script
2121
script = "cp ${subdir}/api.mli ${subdir}/api.ml ${subdir}/plugin3.ml \
2222
${subdir}/plugin.ml sub"
23-
****** ocamlopt.byte
23+
****** ocamlopt.opt
2424
module = "api.ml"
25-
******* ocamlopt.byte
25+
******* ocamlopt.opt
2626
flags = "-opaque"
2727
module = "plugin.mli"
28-
******** ocamlopt.byte
28+
******** ocamlopt.opt
2929
flags = ""
3030
module = "plugin.ml"
31-
********* ocamlopt.byte
31+
********* ocamlopt.opt
3232
module= ""
3333
flags = "-shared"
3434
program = "plugin.so"
3535
all_modules = "plugin.cmx"
3636
********** script
3737
script = "mv plugin.cmx plugin.cmx.bak"
38-
*********** ocamlopt.byte
38+
*********** ocamlopt.opt
3939
flags = ""
4040
module = "plugin2.ml"
4141
************ script
4242
script = "mv plugin.cmx.bak plugin.cmx"
43-
************* ocamlopt.byte
43+
************* ocamlopt.opt
4444
module= ""
4545
flags = "-shared"
4646
program = "plugin2.so"
4747
all_modules = "plugin2.cmx"
48-
************** ocamlopt.byte
48+
************** ocamlopt.opt
4949
flags = ""
5050
module = "sub/plugin.ml"
51-
*************** ocamlopt.byte
51+
*************** ocamlopt.opt
5252
module = ""
5353
flags = "-shared"
5454
program = "sub/plugin.so"
5555
all_modules = "sub/plugin.cmx"
5656
**************** cd
5757
cwd = "sub"
58-
***************** ocamlopt.byte
58+
***************** ocamlopt.opt
5959
module = "api.mli"
6060
flags = "-opaque"
61-
****************** ocamlopt.byte
61+
****************** ocamlopt.opt
6262
flags = ""
6363
module = "api.ml"
6464
******************* script
6565
script = "mv api.cmx api.cmx.bak"
66-
******************** ocamlopt.byte
66+
******************** ocamlopt.opt
6767
module = "plugin3.ml"
6868
********************* script
6969
script = "mv api.cmx.bak api.cmx"
7070
********************** cd
7171
cwd = ".."
72-
*********************** ocamlopt.byte
72+
*********************** ocamlopt.opt
7373
module = ""
7474
flags = "-shared"
7575
program = "sub/plugin3.so"
7676
all_modules = "sub/plugin3.cmx"
77-
************************ ocamlopt.byte
77+
************************ ocamlopt.opt
7878
flags = ""
7979
module = "plugin4.ml"
80-
************************* ocamlopt.byte
80+
************************* ocamlopt.opt
8181
module = ""
8282
flags = "-shared"
8383
program = "plugin4.so"
8484
all_modules = "plugin4.cmx"
85-
************************** ocamlopt.byte
85+
************************** ocamlopt.opt
8686
module = "packed1.ml"
8787
flags = "-for-pack Mypack"
88-
*************************** ocamlopt.byte
88+
*************************** ocamlopt.opt
8989
flags = "-S -pack"
9090
module = ""
9191
program = "mypack.cmx"
9292
all_modules = "packed1.cmx"
93-
**************************** ocamlopt.byte
93+
**************************** ocamlopt.opt
9494
program = "mypack.so"
9595
flags = "-shared"
9696
all_modules = "mypack.cmx"
97-
***************************** ocamlopt.byte
97+
***************************** ocamlopt.opt
9898
program = "packed1.so"
9999
flags = "-shared"
100100
all_modules = "packed1.cmx"
101-
****************************** ocamlopt.byte
101+
****************************** ocamlopt.opt
102102
flags = ""
103103
module = "packed1_client.ml"
104-
******************************* ocamlopt.byte
104+
******************************* ocamlopt.opt
105105
module = ""
106106
program = "packed1_client.so"
107107
flags = "-shared"
108108
all_modules = "packed1_client.cmx"
109-
******************************** ocamlopt.byte
109+
******************************** ocamlopt.opt
110110
flags = ""
111111
module = "pack_client.ml"
112-
********************************* ocamlopt.byte
112+
********************************* ocamlopt.opt
113113
module = ""
114114
program = "pack_client.so"
115115
flags = "-shared"
116116
all_modules = "pack_client.cmx"
117-
********************************** ocamlopt.byte
117+
********************************** ocamlopt.opt
118118
flags = ""
119119
module = "plugin_ref.ml"
120-
*********************************** ocamlopt.byte
120+
*********************************** ocamlopt.opt
121121
module = ""
122122
program = "plugin_ref.so"
123123
flags = "-shared"
124124
all_modules = "plugin_ref.cmx"
125-
************************************ ocamlopt.byte
125+
************************************ ocamlopt.opt
126126
flags = ""
127127
module = "plugin_high_arity.ml"
128-
************************************* ocamlopt.byte
128+
************************************* ocamlopt.opt
129129
module = ""
130130
program = "plugin_high_arity.so"
131131
flags = "-shared"
132132
all_modules = "plugin_high_arity.cmx"
133-
************************************** ocamlopt.byte
133+
************************************** ocamlopt.opt
134134
flags = "-ccopt ${shared_library_cflags}"
135135
module = "factorial.c"
136-
*************************************** ocamlopt.byte
136+
*************************************** ocamlopt.opt
137137
flags = ""
138138
module = "plugin_ext.ml"
139-
**************************************** ocamlopt.byte
139+
**************************************** ocamlopt.opt
140140
module = ""
141141
program = "plugin_ext.so"
142142
flags = "-shared"
143143
all_modules = "factorial.${objext} plugin_ext.cmx"
144-
***************************************** ocamlopt.byte
144+
***************************************** ocamlopt.opt
145145
module = "plugin_simple.ml"
146146
flags = ""
147-
****************************************** ocamlopt.byte
147+
****************************************** ocamlopt.opt
148148
module = ""
149149
program = "plugin_simple.so"
150150
flags = "-shared"
151151
all_modules = "plugin_simple.cmx"
152-
****************************************** ocamlopt.byte
152+
****************************************** ocamlopt.opt
153153
module = "bug.ml"
154154
flags = ""
155-
******************************************* ocamlopt.byte
155+
******************************************* ocamlopt.opt
156156
module = ""
157157
program = "bug.so"
158158
flags = "-shared"
159159
all_modules = "bug.cmx"
160-
******************************************* ocamlopt.byte
160+
******************************************* ocamlopt.opt
161161
module = "plugin_thread.ml"
162162
flags = ""
163-
******************************************** ocamlopt.byte
163+
******************************************** ocamlopt.opt
164164
module = ""
165165
program = "plugin_thread.so"
166166
flags = "-shared"
167167
all_modules = "plugin_thread.cmx"
168-
********************************************* ocamlopt.byte
168+
********************************************* ocamlopt.opt
169169
program = "plugin4_unix.so"
170170
all_modules = "unix.cmxa plugin4.cmx"
171-
********************************************** ocamlopt.byte
171+
********************************************** ocamlopt.opt
172172
flags = ""
173173
compile_only = "true"
174174
all_modules = "a.ml b.ml c.ml main.ml"
175-
*********************************************** ocamlopt.byte
175+
*********************************************** ocamlopt.opt
176176
module = ""
177177
compile_only = "false"
178178
flags = "-shared"
179179
program = "a.so"
180180
all_modules = "a.cmx"
181-
************************************************ ocamlopt.byte
181+
************************************************ ocamlopt.opt
182182
program = "b.so"
183183
all_modules = "b.cmx"
184-
************************************************* ocamlopt.byte
184+
************************************************* ocamlopt.opt
185185
program = "c.so"
186186
all_modules = "c.cmx"
187-
************************************************** ocamlopt.byte
187+
************************************************** ocamlopt.opt
188188
program = "mylib.cmxa"
189189
flags = "-a"
190190
all_modules = "plugin.cmx plugin2.cmx"
191-
*************************************************** ocamlopt.byte
191+
*************************************************** ocamlopt.opt
192192
program = "mylib.so"
193193
flags = "-shared -linkall"
194194
all_modules = "mylib.cmxa"
195-
**************************************************** ocamlopt.byte
195+
**************************************************** ocamlopt.opt
196196
program = "${test_build_directory}/main.exe"
197197
libraries = "unix threads dynlink"
198198
flags = "-linkall"

testsuite/tests/lib-dynlink-native/plugin_thread.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ let () =
55
(fun () ->
66
for i = 1 to 5 do
77
print_endline "Thread"; flush stdout;
8-
Thread.delay 1.;
8+
Thread.delay 0.1;
99
done
1010
) ()
1111
in
1212
for i = 1 to 10 do
1313
print_endline "Thread"; flush stdout;
14-
Thread.delay 0.50;
14+
Thread.delay 0.05;
1515
done

testsuite/tests/lib-systhreads/testfork.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ let compute_thread c = ignore c
1919

2020
let main () =
2121
ignore(Thread.create compute_thread '1');
22-
Thread.delay 1.0;
22+
Thread.delay 0.1;
2323
print_string "Forking..."; print_newline();
2424
match Unix.fork() with
2525
| 0 ->
26-
Thread.delay 0.5;
26+
Thread.delay 0.05;
2727
print_string "In child..."; print_newline();
2828
Gc.minor();
2929
print_string "Child did minor GC."; print_newline();
3030
ignore(Thread.create compute_thread '2');
31-
Thread.delay 1.0;
31+
Thread.delay 0.1;
3232
print_string "Child is exiting."; print_newline();
3333
exit 0
3434
| pid ->
3535
print_string "In parent..."; print_newline();
36-
Thread.delay 4.0;
36+
Thread.delay 0.4;
3737
print_string "Parent is exiting."; print_newline();
3838
exit 0
3939

testsuite/tests/lib-systhreads/testpreempt.ml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,21 @@ let rec generate_list n =
1818
in
1919
aux [] n
2020

21+
let finished = ref false
22+
2123
let rec long_computation time0 =
2224
let long_list = generate_list 100000 in
2325
let res = List.length (List.rev_map sin long_list) in
24-
if Sys.time () -. time0 > 2. then
26+
if Sys.time () -. time0 > 1. || !finished then
2527
Printf.printf "Long computation result: %d\n%!" res
2628
else long_computation time0
2729

2830
let interaction () =
29-
Thread.delay 0.1;
31+
Thread.delay 0.01;
3032
Printf.printf "Interaction 1\n";
31-
Thread.delay 0.1;
32-
Printf.printf "Interaction 2\n"
33+
Thread.delay 0.01;
34+
Printf.printf "Interaction 2\n";
35+
finished := true
3336

3437
let () =
3538
ignore (Thread.create interaction ());

testsuite/tests/lib-systhreads/threadsigmask.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let rec loop () =
2020
in
2121
aux [] n
2222
in
23-
let long_list = generate_list 100000 in
23+
let long_list = generate_list 1000 in
2424
let res = List.length (List.rev_map sin long_list) in
2525
ignore (Sys.opaque_identity res)
2626

@@ -54,18 +54,18 @@ let _ =
5454
let pid = Unix.getpid () in
5555
let cntsent = ref 0 in
5656
(* We loop until each thread has received at least 5 signals and we
57-
have sent more than 100 signals in total. We do not check that all
57+
have sent more than 10 signals in total. We do not check that all
5858
signals get handled, because they could be missed because of the
5959
lack of fairness of the scheduler. *)
60-
while !cntsent < 100 || !cnt1 < 5 || !cnt2 < 5 do
60+
while !cntsent < 10 || !cnt1 < 5 || !cnt2 < 5 do
6161
Unix.kill pid Sys.sigusr1;
6262
Unix.kill pid Sys.sigusr2;
6363
incr cntsent;
6464
Thread.delay 0.07;
6565

6666
(* Still, if too many signals have been sent, we interrupt the
6767
test to avoid a timeout. *)
68-
if !cntsent > 2000 then begin
68+
if !cntsent > 200 then begin
6969
stopped := true;
7070
Thread.join t1;
7171
Printf.printf "A thread does not receive signals. %d %d %d\n" !cnt1 !cnt2 !cntsent;

testsuite/tests/lib-threads/beat.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ let tick (delay, count) =
1919

2020
let _ =
2121
let c1 = ref 0 and c2 = ref 0 in
22-
ignore (Thread.create tick (0.333333333, c1));
23-
ignore (Thread.create tick (0.5, c2));
24-
Thread.delay 3.0;
22+
ignore (Thread.create tick (0.0333333333, c1));
23+
ignore (Thread.create tick (0.05, c2));
24+
Thread.delay 0.3;
2525
let n1 = !c1 and n2 = !c2 in
2626
if n1 >= 8 && n1 <= 10 && n2 >= 5 && n2 <= 7
2727
then printf "passed\n"

testsuite/tests/lib-threads/close.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let main () =
1111
let (rd, wr) = Unix.pipe() in
1212
let t = Thread.create
1313
(fun () ->
14-
Thread.delay 1.0;
14+
Thread.delay 0.1;
1515
print_endline "closing fd...";
1616
Unix.close wr;
1717
)

0 commit comments

Comments
 (0)