Skip to content

Commit 43b3650

Browse files
vouillonhhugo
authored andcommitted
Documentation updates
1 parent cc1896d commit 43b3650

File tree

7 files changed

+18
-22
lines changed

7 files changed

+18
-22
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Features/Changes
33
* Misc: bump min ocaml version to 4.08
44
* Misc: remove some old runtime files to support some external libs
5-
* Effects: improved CPS transform, resulting in lower compilation time and smaller generated code
5+
* Effects: partial CPS transformation, resulting in much better performances, lower compilation time and smaller generated code
66
* Compiler: separate compilation can now drops unused units when linking (similar to ocamlc). (#1378)
77
Feature is disabled by default while dune rules are being fixed. Enable with --enable=auto-link.
88
* Compiler: specialize string to js-string conversion for all valid utf8 strings (previously just ascii)

manual/effects.wiki

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
== Effect handlers ==
22

33
Js_of_ocaml supports effect handlers with the {{{--enable=effects}}}
4-
flag. This is based on transformation of the whole program to
4+
flag. This is based on partially transforming the program to
55
continuation-passing style.
66
As a consequence, [[tailcall|tail calls]] are also fully optimized.
7-
This is not the default for now since the generated code is slower,
7+
This is not the default for now since the generated code can be slower,
88
larger and less readable.
9-
The [[performances|performance impact]] is especially large for code
10-
that involves a lot of function calls without allocation, since the
11-
transformation introduces many intermediate continuation
12-
functions.
13-
We hope to improve on this by transforming the code only partially to
14-
continuation-passing style, and by trying alternative compilation
9+
The transformation is based on an analysis to detect parts of the code that cannot involves effects and keep it in direct style.
10+
The analysis is especially effective on monomorphic code. It is not so effective when higher-order functions are heavily used ({{{Lwt}}}, {{{Async}}}, {{{incremental}}}).
11+
We hope to improve on this by trying alternative compilation
1512
strategies.
1613

17-
1814
=== Dune integration ===
1915

2016
We're still working on dune support for compiling js_of_ocaml programs
@@ -63,4 +59,4 @@ Trying to use separate compilation would result in a error while attempting to l
6359
js_of_ocaml: Error: Incompatible build info detected while linking.
6460
- test6.bc.runtime.js: effects=false
6561
- .cmphash.eobjs/byte/dune__exe.cmo.js: effects=true
66-
}}}
62+
}}}
-8 Bytes
Loading
1.8 KB
Loading
-398 Bytes
Loading

manual/overview.wiki

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ functions are optimized:
7979
* trampolines are used otherwise.
8080
<<a_manual chapter="tailcall" |More about tail call optimization>>.
8181
82-
Effect handlers are fully supported with the {{{--enable=effects}}} flag. This is not the default for now since the generated code is slower, larger and less readable.
82+
Effect handlers are fully supported with the {{{--enable=effects}}} flag. This is not the default for now since effects are not widely used at the moment and the generated code can be slower, larger and less readable.
8383
8484
Data representation differs from the usual one. Most notably,
8585
integers are 32 bits (rather than 31 bits or 63 bits), which is their

manual/performances.wiki

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +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 30% 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-
hardly increases 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 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}}}).
29+
is about 20% larger. The impact on compressed code is actually much
30+
lower since we are adding a lot of function definitions, which are
31+
rather verbose in JavaScript but compress well: the compressed code
32+
size hardly increases for large files compressed with {{{bzip2}}}.
33+
Code that heavily uses {{{Lwt}}}, {{{Async}}} or {{{Incremental}}} can
34+
see a larger size increase (up to 45% larger, or 7% larger when
35+
compressed). There is almost no speed impact for small monomorphic
36+
programs. We estimate that the slowdown will usually be below 30%,
37+
though it can be larger for code that heavily use higher-order
38+
functions and polymorphism ({{{Lwt}}} code, for instance).
3839

3940
<<a_img src="performances/size-effects.png" | Relative size >>
4041
<<a_img src="performances/size-bzip2-effects.png" | Relative size (compressed with bzip2) >>
4142
<<a_img src="performances/time-effects.png" | Relative execution times >>
42-

0 commit comments

Comments
 (0)