4 ms·
Lots of them, but two key ones: 1. You have much richer libraries available. There's a decent amount of stuff in OPAM these days, but that's dwarf
by gecko 13y ago
Lots of them, but two key ones:
1. You have much richer libraries available. There's a
decent amount of stuff in OPAM these days, but that's
dwarfed by what you can grab out of NuGet.
2. You have a great asynchronous/multithreading story. The F# async
workflow makes it trivial to write multithreaded apps in
a similar way to C#'s async/await calls (in fact, F# is
the origin of that design), and it performs very well.
OCaml still doesn't do very well with multithreaded
programs.
You also lose some things, two of which that are most poignant to me:
1. OCaml is faster than F# for single-threaded programs.
This has nothing to do with Mono's maturity or speed as
such, but does have to do with its garbage collector,
which has not historically dealt well with F#'s allocation
patterns. I have not taken time since SGen landed to
revisit that, though, so the situation might be much
better.
2. OCaml can produce tiny self-contained binaries. Mono's
AOT gets you the self-contained easily, but you'll be
looking at relatively large executables.
- untothebreach 13y agoThanks, the multithreading is definitely a compelling reason
- girvo 13y agoI've been looking at doing something crazy like building a toy kernel + lisp to sit on top of it for the RPi, and I've been looking at OCamL to do it in. Thoughts, as someone who's used it?
- avsm 13y agoOCaml works great for systems programming (its runtime is orders of magnitude simpler than F# and the CLR). See http://openmirage.org http://openmirage.org for a bunch of libraries that may be of use to you, such as TCP/IP in OCaml (or https://github.com/mirage https://github.com/mirage)
- girvo 13y agoBrilliant! Cheers :)
- profquail 13y agoMono's SGen garbage collector is a massive improvement over the older, non-generational GC. SGen still may not be as a good as the GC in the .NET CLR on Windows, but the performance difference is much smaller now (especially since Mono 3.2.x).
- gecko 13y agoHave you tried with F# specifically? Even the old collector generally did fine for C#, but F# tends to allocate a tremendous number of very-short-lived objects, which is where Mono's old GC got unhappy. I actually do fully expect that SGen likely fixes that entirely, but I haven't had a chance to meaningfully benchmark it.
- profquail 13y agoYes, I have tried it specifically with F#. In fact, I contributed some minor patches to the SGen GC so it'd work correctly on FreeBSD, just so I could run F# on FreeBSD using Mono/SGen. SGen is a significant improvement over the older GC for any program running on Mono, but especially for F# programs.
- shadowfox 13y agoFeature-wise you also lose a few more things like OCaml modules and functors (and OCaml style objects, which is not a great loss). You gain integration with .NET (and its classes and objects).