Skip to content

Commit fbb633e

Browse files
vouillonhhugo
authored andcommitted
Update manual (impact on file size)
1 parent 46f4052 commit fbb633e

File tree

8 files changed

+83
-13
lines changed

8 files changed

+83
-13
lines changed

benchmarks/Makefile

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GRAPHSNOPR = time.pdf time-optim.pdf nativejs.pdf
55
GRAPHSPR = size.pdf size-optim.pdf compiletime.pdf
66

77
# graphs showing the impact of supporting effects
8-
GRAPHSEFF = time-effects.pdf size-effects.pdf
8+
GRAPHSEFF = time-effects.pdf size-effects.pdf size-bzip2-effects.pdf
99

1010
# For full benchs:
1111
all: _perf graphsnopr graphspr graphseff _noperf
@@ -14,7 +14,7 @@ graphsnopr: _noprecomp $(GRAPHSNOPR)
1414

1515
graphspr: __precomp $(GRAPHSPR)
1616

17-
graphseff: $(GRAPHSEFF)
17+
graphseff: __precomp $(GRAPHSEFF)
1818

1919
# For fast benchs:
2020
test: _perf fastrun $(GRAPHS) _noperf
@@ -48,7 +48,6 @@ __run:
4848
touch __run
4949

5050
__run_effects:
51-
make _noprecomp
5251
$(RUN) -fast -nobyteopt -effects
5352
touch __run_effects
5453

@@ -165,7 +164,47 @@ size-effects.svg: __run_effects
165164
-omit boyer_no_exc \
166165
-omit kb_no_exc \
167166
-omit loop \
168-
-max 2.5 -svg 7 650 150 -edgecaption -ylabel Size \
167+
-append boulderdash \
168+
-append cubes \
169+
-append minesweeper \
170+
-append planet \
171+
-append js_of_ocaml \
172+
-append ocamlc \
173+
-max 2 -svg 7 650 150 -edgecaption -ylabel Size \
174+
> $@
175+
176+
size-gzipped-effects.svg: __run_effects
177+
$(REPORT) -config report-size-gzipped-effects.config \
178+
-omit binary_trees \
179+
-omit fannkuch_redux \
180+
-omit fannkuch_redux_2 \
181+
-omit boyer_no_exc \
182+
-omit kb_no_exc \
183+
-omit loop \
184+
-append boulderdash \
185+
-append cubes \
186+
-append minesweeper \
187+
-append planet \
188+
-append js_of_ocaml \
189+
-append ocamlc \
190+
-max 1.2 -min 0.8 -svg 7 650 150 -edgecaption -ylabel Size \
191+
> $@
192+
193+
size-bzip2-effects.svg: __run_effects
194+
$(REPORT) -config report-size-bzip2-effects.config \
195+
-omit binary_trees \
196+
-omit fannkuch_redux \
197+
-omit fannkuch_redux_2 \
198+
-omit boyer_no_exc \
199+
-omit kb_no_exc \
200+
-omit loop \
201+
-append boulderdash \
202+
-append cubes \
203+
-append minesweeper \
204+
-append planet \
205+
-append js_of_ocaml \
206+
-append ocamlc \
207+
-max 1.1 -min 0.95 -svg 7 650 150 -edgecaption -ylabel Size \
169208
> $@
170209

171210
compiletime.svg: __run __precomp __missingcompiletimes
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
histogramref sizes "" js_of_ocaml/bzip2 #fbaf4f direct (bzip2)
2+
histogram sizes "" effects/bzip2 #fb4f4f effects (bzip2)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
histogramref sizes "" js_of_ocaml/gzipped #fbaf4f direct (gzip)
2+
histogram sizes "" effects/gzipped #fb4f4f effects (gzip)

benchmarks/report.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ let nreference = ref (-1)
2727

2828
let maximum = ref (-1.)
2929

30+
let minimum = ref 0.
31+
3032
let table = ref false
3133

3234
let omitted = ref []
@@ -201,7 +203,7 @@ let gnuplot_output ch no_header (h, t) =
201203
(if !errors then " lw 1" else "");
202204
if !ylabel <> "" then Printf.fprintf ch "set ylabel \"%s\"\n" !ylabel;
203205
if !maximum > 0.
204-
then Printf.fprintf ch "set yrange [0:%f]\n" !maximum
206+
then Printf.fprintf ch "set yrange [%f:%f]\n" !minimum !maximum
205207
else Printf.fprintf ch "set yrange [0:]\n");
206208
(* labels *)
207209
for i = 0 to n - 1 do
@@ -360,6 +362,7 @@ let _ =
360362
let options =
361363
[ "-ref", Arg.Set_int nreference, "<col> use column <col> as the baseline"
362364
; "-max", Arg.Set_float maximum, "<m> truncate graph at level <max>"
365+
; "-min", Arg.Set_float minimum, "<m> truncate graph below level <min>"
363366
; "-table", Arg.Set table, " output a text table"
364367
; ( "-omit"
365368
, Arg.String (fun s -> omitted := split_on_char s ~sep:',' @ !omitted)

benchmarks/run.ml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ let compr_file_size param =
154154
compile_no_ext param ~comptime:false (fun ~src ~dst ->
155155
Format.sprintf "sed 's/^ *//g' %s | gzip -c | wc -c > %s" src dst)
156156

157+
let bzip2_file_size param =
158+
compile_no_ext param ~comptime:false (fun ~src ~dst ->
159+
Format.sprintf "sed 's/^ *//g' %s | bzip2 -c | wc -c > %s" src dst)
160+
157161
let runtime_size param =
158162
compile_no_ext param ~comptime:false (fun ~src ~dst ->
159163
Format.sprintf
@@ -270,6 +274,24 @@ let _ =
270274
Spec.js_of_ocaml
271275
sizes
272276
(Spec.sub_spec Spec.js_of_ocaml "gzipped");
277+
compr_file_size
278+
param
279+
code
280+
Spec.js_of_ocaml_effects
281+
sizes
282+
(Spec.sub_spec Spec.js_of_ocaml_effects "gzipped");
283+
bzip2_file_size
284+
param
285+
code
286+
Spec.js_of_ocaml_effects
287+
sizes
288+
(Spec.sub_spec Spec.js_of_ocaml_effects "bzip2");
289+
bzip2_file_size
290+
param
291+
code
292+
Spec.js_of_ocaml
293+
sizes
294+
(Spec.sub_spec Spec.js_of_ocaml "bzip2");
273295
runtime_size
274296
param
275297
code
17.3 KB
Loading
3.71 KB
Loading

manual/performances.wiki

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ See how various js_of_ocaml options affect the generated size and execution time
2626
<<a_img src="performances/time-optim.png" | Relative execution times >>
2727

2828
We show the performance impact of supporting effect handlers. The code
29-
is about 20% to 50% larger. The impact on compressed code is actually
30-
lower since we are adding a lot of function definitions, which are
31-
rather verbose in JavaScript but compress well. Code that involves a
32-
lot of function calls without allocation, such as {{{fib}}}, becomes
33-
much slower. The overhead is more reasonable for code that performs a
34-
lot of allocations ({{{hamming}}}) or that performs some numeric
35-
computations ({{{almabench}}}, {{{fft}}}). Exception handling is
36-
faster ({{{boyer}}}).
29+
is about 50% larger. The impact on compressed code is actually much lower
30+
since we are adding a lot of function definitions, which are rather
31+
verbose in JavaScript but compress well: the compressed code size
32+
increase by about only 5% for large files compressed with {{{bzip2}}}.
33+
Code that involves a lot of function calls without allocation, such as
34+
{{{fib}}}, becomes much slower. The overhead is more reasonable for
35+
code that performs a lot of allocations ({{{hamming}}}) or that
36+
performs some numeric computations ({{{almabench}}}, {{{fft}}}).
37+
Exception handling is faster ({{{boyer}}}).
3738

3839
<<a_img src="performances/size-effects.png" | Relative size >>
40+
<<a_img src="performances/size-bzip2-effects.png" | Relative size (compressed with bzip2) >>
3941
<<a_img src="performances/time-effects.png" | Relative execution times >>
4042

0 commit comments

Comments
 (0)