-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Benchmarking js_of_ocaml library with auto
only times constructor
#38
Comments
auto
only times constructor
For anyone who is looking for a workaround to this, here is what I was able to do: Inside the function I care about ( Landmark.start_profiling () ; Then, before returning the result, Landmark.stop_profiling () ;
let gc = Landmark.export_and_reset () in
Landmark.Graph.output Out_channel.stderr gc ; Then, running It would be great if |
Hello thanks for the report ! There's something I don't understand. Would you have a small reproduction case I could look into ? |
Here is what I think is happening just by reading this thread. let () =
Js.export "somefun" some_function This will just export the function to js and continue executing the rest of the ocaml code. In particular, Std_exit will execute last and probability trigger dumping the results, too early, before you run your JavaScript function manually. |
Here is an example: I suspect @hhugo's explanation is correct. Dune considers all js_of_ocaml programs to be "executables", even in cases like this were the obvious purpose is to export a bunch of functions and use it as a library |
I have been trying to use the new compatibility with js_of_ocaml added in #36.
I have my code organized into a library with the final part of my code being
This is then called in javascript with
and I run the whole thing with
OCAML_LANDMARKS="format=textual" node test.js
Landmarks does produce output, but it seems that it only profiles the setup code being run, not the eventual use of some_function. If I put a print statement in some_function, it is printed after the output of Landmarks, which is full of timings for loading different modules in my code.
The text was updated successfully, but these errors were encountered: