Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 534

Js_of_ocaml output performs considerably worse when built with --profile=release flag

$
0
0

Hi everyone! I have been using js_of_ocaml (via the Brr toolkit) to run my pure OCaml Game Boy emulator in the browser. I am now trying to minify the JS bundle, and one thing I noticed is that the JS output compiled with the --profile=release flag (via dune build --profile release) performs considerably worse, in terms of speed, compared to the output compiled without the flag (via dune build). This was surprising as I was expecting the release build to perform the same (if not slightly better) than the normal build.

I have hosted the emulator without the UI (i.e. in “headless” mode) in the following URLs to demonstrate the difference:

When I run both builds in my local environment (i7-8665U CPU @ 1.90GHz, Ubuntu 20.04.2, Google Chrome Version 95.0.4638.69), the former runs at ~260 FPS while the latter runs at ~116 FPS.

You can also compare them with the UI here:

  • Built with dune build: CAMLBOY
  • Built with dune build --profile=release: CAMLBOY

Question:
Is this expected behavior and/or am I completely missing something? And is there some way to get a minified output without a performance hit?

Thanks!

18 posts - 9 participants

Read full topic


Viewing all articles
Browse latest Browse all 534

Trending Articles