For example:
(executable
((name test)
(js_of_ocaml ((flags (:standard --opt 3 --pretty +weak.js))))
(libraries (js_of_ocaml core_kernel))))
With test.ml containing:
let _ = Core_kernel.Time.now ()
And building with jbuilder build test.bc.js.
The generated test.bc.js contains quite a few calls similar to the ones below:
test_unit
(_u4_,
_aCq_,
0,
_aCp_,
793,
4,
63,
function(param){return test(1,3609444,_aCo_)});
test_unit
(_u4_,
_auK_,
0,
_auJ_,
333,
4,
214,
function(param)
{return round_trip$0
(to_parts$1(create$31(0,0,[0,hr],0,0,0,0,0,0)))});
_avr_=caml_new_string(": <<test true 71 1666750235549516973L>>"),
_avt_=caml_new_string("src/time_ns.ml"),
_avu_=caml_new_string(": <<test true 4398 1232807081547132235L>>"),
_avw_=caml_new_string("src/time_ns.ml"),
_avx_=caml_new_string(": <<test false 702561 1233263206897519979L>>"),
_avz_=caml_new_string("src/time_ns.ml"),
Note that this is at the maximum optimisation level that jsoo supports (as far as I know). jsoo is able to remove the entire module if it isn't referenced (for example when test.ml is empty), but it doesn't seem to be able to remove the values exported for the inline tests.
For example:
With test.ml containing:
And building with
jbuilder build test.bc.js.The generated
test.bc.jscontains quite a few calls similar to the ones below:Note that this is at the maximum optimisation level that jsoo supports (as far as I know). jsoo is able to remove the entire module if it isn't referenced (for example when test.ml is empty), but it doesn't seem to be able to remove the values exported for the inline tests.