# Execution speed of jsoo/rescript output?

**URL:** <https://discuss.ocaml.org/t/execution-speed-of-jsoo-rescript-output/11578>\
**Category:** Learning\
**Created:** [March 4, 2023, 2:04pm UTC](https://discuss.ocaml.org/t/execution-speed-of-jsoo-rescript-output/11578 "2023-03-04T14:04:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeroexcuses](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/zeroexcuses/32/1692_2.png) [@zeroexcuses](https://discuss.ocaml.org/u/zeroexcuses)\
**Post date:** [March 4, 2023, 2:04pm UTC](https://discuss.ocaml.org/t/execution-speed-of-jsoo-rescript-output/11578/1 "2023-03-04T14:04:43Z")

</div>

For code that can compile both under jsoo & rescript, are there rules of thumb regarding execution speed? I.e.

- A generally faster than B
- B generally faster than A
- can’t really tell

…

---

<div class="post-metadata">

**Author:** ![mooreryan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mooreryan/32/2843_2.png) [@mooreryan](https://discuss.ocaml.org/u/mooreryan)\
**Post date:** [March 4, 2023, 6:45pm UTC](https://discuss.ocaml.org/t/execution-speed-of-jsoo-rescript-output/11578/2 "2023-03-04T18:45:38Z")

</div>

You may have better luck finding info about this if you include bucklescript in your searches. For example [Benchmarking bucklescript vs js of ocaml](https://discuss.ocaml.org/t/benchmarking-bucklescript-vs-js-of-ocaml/3191/).

This is obviously not solid data for you, but it seems from reading various threads about it, that ReScript generates code that’s a little more optimized/fast than jsoo, (likely?) because it can be closer to what you _might_ write by hand.

---

<div class="post-metadata">

**Author:** ![Jon\_Harrop](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jon_harrop/32/2015_2.png) [@Jon\_Harrop](https://discuss.ocaml.org/u/Jon_Harrop)\
**Post date:** [March 4, 2023, 10:22pm UTC](https://discuss.ocaml.org/t/execution-speed-of-jsoo-rescript-output/11578/3 "2023-03-04T22:22:41Z")

</div>

I’m curious to know ballpark relative performance figures for code compiled with ocamlopt, ocamlc and those two JS backends. I’d guess rescript generally outperforms ocamlc but is it 2x slower than ocamlopt or 5x?

---

<div class="post-metadata">

**Author:** ![mooreryan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mooreryan/32/2843_2.png) [@mooreryan](https://discuss.ocaml.org/u/mooreryan)\
**Post date:** [March 5, 2023, 3:29am UTC](https://discuss.ocaml.org/t/execution-speed-of-jsoo-rescript-output/11578/4 "2023-03-05T03:29:22Z")

</div>

There are some pretty detailed benchmarks about that in the jsoo [manual](https://ocsigen.org/js_of_ocaml/latest/manual/performances). It doesn’t include rescript/bucklescript, but does for ocamlopt, ocamlc, and jsoo and some handwritten JS as well.
