I believe that statement is meant in comparison to the OCaml stdlib, which also ships with ReScript. For example, using the Belt.Map
module will be much more performant than using the OCaml Map
module.
The Js
modules will always produce a smaller code size because they’re all (almost) zero-cost bindings. As for performance between Belt
and Js
, my experience has found that they’re basically the same.
There are a few cases where Belt’s functions actually can be faster, since they’re implemented differently than in JS. For example, Belt.Array.map
is simply a loop. The built-in JS map
is slower because it does things like check for sparse arrays. (Sparse arrays aren’t allowed by the ReScript type-checker, so Belt doesn’t account for them.) Overall, these cases aren’t important to know unless you’re really trying to optimize a benchmark, in which case you’re better off just using a loop directly.