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.
In this particular case, I’m really after concrete comparisons. I feel like there should be a < 100 line snippet comparing w/ Effect vs wo/ Effect, showing how w/ Effect clearly wins.
What does win mean for you?
Eio shows you can have sane async I/O without monadic style programming, and you can compare it to lwt/async.
It’s a win in my book.
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).