Jérôme Vouillon
Jérôme Vouillon
Code like `let rec f x y = 1 and z = Some (f, h)` is compiled using primitive `caml_alloc_dummy` to allocate a block (for all values but floats, including...
I'm wondering whether we could do something for recursive modules as well. At the moment, we have a hack that replaces the bytecode implementation of CamlinternalMod by a JavaScript implementation.
If `String.copy` and `(^)` were implemented as primitive, we could more easily generate efficient code for them.
OCaml is switching to immutable strings. However, as they are implemented imperatively, based on byte sequence operations, there does not seem to be any easy way to take advantage of...
We should probably map OCaml values to JavaScript objects rather than JavaScript arrays. Indeed, this is more memory efficient (V8 has a high overhead for arrays; the block tag would...
This is because you are using numeric fields. Here is what I get by manually tweaking the JavaScript output: | | Arrays | Objects (numeric fields) | Objects (non-numeric fields)...
Which JavaScript engine did you try? Which version?
That's the timings for a single program, that I manually rewrote. You're right that for making this work the OCaml compiler would have to be modified.
Indeed, we should probably disable inlining when any of the inner or outer function contain a `try...with`. Also, at the moment, the toplevel of all modules are concatenated, so if...
There is no reason to share the same format, as the generated codes are not compatible.