I just spent a day of my life learning about building dune / jsoo / effects – and after getting effects working, realized to my horror, that according to https://ocsigen.org/js_of_ocaml/latest/manual/performances , it might slow down my code up to a factor of 9.04 (worst case, bdd example).
Question: is there a concise example of the power of effects? I.e. side by side comparisons of simple code snippets of the form:
To my understanding the big win with effects is enabling direct-style async I/O, this is demonstrated in the Eio library. The project readme has a great, comprehensive tutorial that walks through the main points.
To put it another way, the big win with effects is not that most devs would be using it directly, but rather that they would almost never need to.
There is almost no speed impact for small monomorphic programs. We estimate that the slowdown will usually be below 30%, though it can be larger for code that heavily use higher-order functions and polymorphism (Lwt code, for instance).