Skip to content

Commit e709536

Browse files
committed
Documentation updates
1 parent f0e07f1 commit e709536

File tree

11 files changed

+41
-4
lines changed

11 files changed

+41
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ optimized:
9494
[More](http://ocsigen.org/js_of_ocaml/dev/manual/tailcall) about tail call
9595
optimization.
9696

97+
Effect handlers are supported with the `--enable=effects` flag.
98+
9799
## Data representation
98100

99101
Data representation differs from the usual one. Most notably, integers are 32

benchmarks/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ time-effects.svg: __run_effects
154154
-omit fannkuch_redux \
155155
-omit fannkuch_redux_2 \
156156
-omit loop \
157-
-max 2.5 -svg 7 400 150 -edgecaption -ylabel "Execution time" \
157+
-max 5 -svg 7 400 150 -edgecaption -ylabel "Execution time" \
158158
> $@
159159

160160
size-effects.svg: __run_effects
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
histogramref times node js_of_ocaml #fbaf4f direct
2-
histogram times node effects #fb4f4f effects
1+
histogramref times node js_of_ocaml #fbaf4f default
2+
histogram times node effects #fb4f4f --enable=effects

manual/effects.wiki

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
== Effect handlers ==
2+
3+
Js_of_ocaml supports effect handlers with the {{{--enable=effects}}}
4+
flag. This is based on transformation of the whole program to
5+
continuation-passing style.
6+
As a consequence, [[tailcall|tail calls]] are also fully optimized.
7+
This is not the default for now since the generated code is slower,
8+
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
15+
strategies.
10.9 KB
Loading
23.8 KB
Loading

manual/menu.wiki

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
==[[linker|Link javascript code]]
2020
==[[separate-compilation|Separate compilation]]
2121
==[[tailcall|About tailcall optimization]]
22+
==[[effects|Effect handlers]]
2223

2324
=Misc
2425
==[[runtime-files|How to look up runtime files]]

manual/options.wiki

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
|= Option name |= Default |= Description |
3636
| pretty | false | Pretty print the javascript output |
37+
| effects | false | Enable support for effect handlers |
3738
| debuginfo | false | Output debug information (location) |
3839
| deadcode | true | Deadcode elimination |
3940
| inline | true | Code inlining |

manual/overview.wiki

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ functions are optimized:
7777
* trampolines are used otherwise.
7878
<<a_manual chapter="tailcall" |More about tail call optimization>>.
7979
80+
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.
81+
8082
Data representation differs from the usual one. Most notably,
8183
integers are 32 bits (rather than 31 bits or 63 bits), which is their
8284
natural size in JavaScript, and floats are not boxed. As a

manual/performances.wiki

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,17 @@ See how various js_of_ocaml options affect the generated size and execution time
2424

2525
<<a_img src="performances/size-optim.png" | Relative size >>
2626
<<a_img src="performances/time-optim.png" | Relative execution times >>
27+
28+
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}}}).
37+
38+
<<a_img src="performances/size-effects.png" | Relative size >>
39+
<<a_img src="performances/time-effects.png" | Relative execution times >>
40+

0 commit comments

Comments
 (0)