71 points · by rbjorklin · 6y ago · 17 comments
In terms of performance it varies. The benchmarks in that paper it ranges from a 20% slowdown to a 20% speedup - most macro benchmarks are <10%. There's also still some more performance work we can do to chip away at that further.
[1] https://docs.microsoft.com/en-us/dotnet/api/system.threading...
Right now, OCaml is very... concrete. You have to call different functions to find the length of a string, a list, or an array. Modular implicits would get rid of all that bullshit. We could do more type-level programming, instead of the "earth-bound" kind of stuff we do now. Here's a 2014 paper on it: http://www.lpw25.net/papers/ml2014.pdf
The only problem is that, well, it's from 2014. OCaml moves unbearably slow compared to any other language (except maybe Python). It seems like there's a lack of knowledgeable contributors, which is a shame. But maybe if OCaml was rewritten from scratch using LLVM IR, more progress could be made. But I don't really know, I'm not an OCaml internals expert.
Modular implicits are not typeclasses.
> With typeclasses, we could get a collections api, monads, etc.
OCaml already has that through parameterized modules modules and inclusion. Modular implicits would not fundamentally change that. It would make calling a bit less cumbersome (but with local opening, it's already not that bad).
Sadly, implementing modular implicits properly is a tremendous undertaking.
> OCaml moves unbearably slow compared to any other language (except maybe Python).
I personally find Ocaml to move quite fast. Actually I think it has never been that fast. There is a release every six months and the last few releases have seen significant improvements on every fronts: performance (flambda), the standard library (notably with regard to collections) and syntax (let+ and let*).
> But maybe if OCaml was rewritten from scratch using LLVM IR, more progress could be made.
One of the most enjoyable part of writting Ocaml is how fast and efficient the compiler is. I personnaly fail to see what porting it to LLVM IR would bring (apart from more compilation targets). I mean, no one would complain if someone did the port but that seems like a lot of work for meagre returns.
The goal is to remove this lock in a way that is safe and allows programs to continue being fast.