News for hackers. Stuff that matters.
Re:Multicore OCaml: Feb 2020 update by UncleOxidant on Friday February 28, 2020 @12:08PM (#22444248)
Some of both I'd guess. Go was probably written from the start with multicore in mind. Not sure when Haskell went multicore. Taking an existing language implementation like OCaml's from single to multicore is a lot of work. Much of this work is in the GC. As I understand it, they're also not wanting to impact single core performance (I believe that's an INRIA requirement in order for them to accept the changes).
Re:Multicore OCaml: Feb 2020 update by YawningAngel on Friday February 28, 2020 @12:20PM (#22444364)
The original presentation on Concurrent Haskell is dated 1996 (http://www.haskell.org/ghc/docs/papers/concurrent-haskell.ps...)
Re:Multicore OCaml: Feb 2020 update by nerpderp82 on Friday February 28, 2020 @12:12PM (#22444292)
> not wanting to impact single core performance

That seems like an over burdensome requirement given that we are swimming in cores. A 10% loss in single core performance vs 1.2x-Nx multicore performance increase would be an adequate tradeoff.

The only other option I can think of is having two different backends, one that is entirely single threaded and doesn't incur any multicore performance penalty.

Re:Multicore OCaml: Feb 2020 update by YawningAngel on Friday February 28, 2020 @12:24PM (#22444406)
By definition OCaml's entire userbase consists of programs that run on a single core, so a 10% regression in single core performance is going to be a pretty hard sell.
Re:Multicore OCaml: Feb 2020 update by nerpderp82 on Friday February 28, 2020 @12:36PM (#22444519)
I would argue that single core only OCaml could be released in parallel (heh) with a multicore OCaml. Legacy users could opt for the single core runtime distribution.

As soon as you get parallel gc, MPMC queues, parallel sorting, set intersection, etc. Many programs will see about a 1.x speed up making the point moot.

Erlang went through this same transition.

Re:Multicore OCaml: Feb 2020 update by YawningAngel on Friday February 28, 2020 @01:24PM (#22445019)
Maintaining two parallel distributions is a lot of work for a relatively niche language with a small community.
Re:Multicore OCaml: Feb 2020 update by nerpderp82 on Friday March 06, 2020 @01:25PM (#22505930)
One build has locks, the other does not.

If OCaml wants to remain somewhat viable it will need to be able to use more than one core. The most users of OCaml is always right now. This won't always be the case if they cannot go multicore.

Re:Multicore OCaml: Feb 2020 update by pdimitar on Friday February 28, 2020 @06:43PM (#22447478)
Can you expand on the Erlang history? Really interesting.
Re:Multicore OCaml: Feb 2020 update by monadic2 on Friday February 28, 2020 @03:04PM (#22445842)
Presumably if performance were a key concern you wouldn't have used OCaml to begin with.
Re:Multicore OCaml: Feb 2020 update by wk_end on Friday February 28, 2020 @03:29PM (#22446027)
Ocaml can be extremely performant - both in terms of throughput and latency - in the single-threaded case. There's a particular set of problems where Ocaml's performance is bottlenecked without multicore, but that's far from most.

Anecdotally, I once worked at an Ocaml trading firm - where microseconds could matter! - and at least at the time, folks there weren't particularly interested in multicore. We have async/lwt already, and we spun up multiple processes for parallelism. A 10% performance drop for multicore support that we didn't need would have been unacceptable for us.

Re:Multicore OCaml: Feb 2020 update by akhilcacharya on Friday February 28, 2020 @04:29PM (#22446555)
Don't many trading firms explicitly disable cores on their trade execution machines? I know Optiver does.
Re:Multicore OCaml: Feb 2020 update by monadic2 on Saturday February 29, 2020 @11:11PM (#22455065)
Sure.
Re:Multicore OCaml: Feb 2020 update by LeonidasXIV on Friday February 28, 2020 @03:09PM (#22445880)
Curious claim, considering OCaml fares pretty well in many language comparison benchmarks.
Re:Multicore OCaml: Feb 2020 update by jfkebwjsbx on Friday February 28, 2020 @03:22PM (#22445965)
Language comparison benchmarks are a tiny part of actual performance in the real world.
Re:Multicore OCaml: Feb 2020 update by LeonidasXIV on Friday February 28, 2020 @03:34PM (#22446075)
They do translate into real-life performance though and unlike many other languages, for the most part without "writing C in language X".
Re:Multicore OCaml: Feb 2020 update by jfkebwjsbx on Friday February 28, 2020 @05:36PM (#22447058)
Extraordinary claims require extraordinary evidence.

Claiming a functional language is as performant as a systems language is a very big claim.

Re:Multicore OCaml: Feb 2020 update by patrec on Friday February 28, 2020 @06:21PM (#22447343)
What's a "systems language"? Someone recently posted "awk as a major systems programming language".

Ocaml is used in many performance and latency sensitive domains as a minimal amount of research would show you. Here's an example:

https://www.janestreet.com/tech-talks/building-an-exchange/

It's also got a reputation for pretty predictable performance characteristics, fast compilation and ease of writing correct and concise code, properties C++, for example, does not necessarily share. Part of this is because the compiler is comparatively straightforward in what it does (and same for standard library), with the flip side that you leave some performance on the table. But that might not be a bad trade-off given that ocaml generally seems to be within a factor of ~3x of C++ (which can probably easily baloon up for specific problems, given that ocaml has e.g. poor SIMD and machine size int support). So you probably wouldn't want to write AAA game engines, crypto libs or numerical kernels in it. But my guess is that a language with those characteristics (and much faster iteration times) translates to better real world performance for many other types of tasks.

Re:Multicore OCaml: Feb 2020 update by jfkebwjsbx on Saturday February 29, 2020 @11:04AM (#22451197)
The same way you ask me to do a "minimal amount of research", you should do the same to answer the question about what is a systems programming language.

Claiming "within ~3x of C++" answers your question. For the problems I work in (some of which you mention) even a 5% is a major deal. 300%? That’s just crazy talk and a non-starter.

That’s what performance means and why most language benchmarks are usually useless: people writing them have no clue of what are the requirements of many fields.

Re:Multicore OCaml: Feb 2020 update by pjmlp on Sunday March 01, 2020 @05:56AM (#22456322)
Parts of the Xen Hypervisor, Docker TPC/IP stack integration with the host OS, and the MirageOS are written in OCaml, it looks pretty much systems programming to me.

Likewise, there is an endless amount of compilers in research written in OCaml.

Last time I checked, anything related to compiler toolchains used to be considered systems programming.

Re:Multicore OCaml: Feb 2020 update by patrec on Saturday February 29, 2020 @04:45PM (#22453333)
I tend to do my homework – system programming language is not some narrowly defined concept with an universally agreed on definition. People frequently put Go and Swift in that category (see the wikipedia). Are you suggesting Swift is systems programming when Ocaml isn't? If you run docker on Windows or macOS you are running a tcp/ip stack in ocaml (unless something has recently changed).

I assume you mean 105% and 300%? And what are the 105% that are a major deal – the runtime relative to what the hardware could theoretically do? Or 105% relative to what you can get out of C++?

Re:Multicore OCaml: Feb 2020 update by owl57 on Friday February 28, 2020 @12:29PM (#22444454)
OCaml has an unusual share of latency-sensitive stakeholders, probably only comparable with Go of all garbage-collected languages. As far as I heard, optimizing Go's GC for latency has been an awful lot of work.
Re:Multicore OCaml: Feb 2020 update by dan-robertson on Friday February 28, 2020 @05:53PM (#22447170)
Any reasonably widely used language will have users who care about latency. People write user interfaces in Java so clearly it’s users care about latency. Similarly for JavaScript except I would expect a react user interface to produce a lot more allocation pressure than a java one (and so gc latency and throughput both matter). Even emacs lisp cares about latency (the main user visible improvement was not printing “garbage collected” each time the gc ran).

For things like servers, latency can matter to some extent because of the resource usage of in-flight requests. It is desirable to serve requests quickly to free up resources on the server and any clients too.

Similarly one will find plenty of apps which care about throughput too.

Re:Multicore OCaml: Feb 2020 update by mumblemumble on Friday February 28, 2020 @06:12PM (#22447288)
> Any reasonably widely used language will have users who care about latency.

Right, but, to the parent's point, OCaml, with its HFT pedigree, has an unusual level of latency sensitivity in its userbase.

I can't speak for Jane Street, but, at the prop shop where I did my time, nobody found it all that peculiar to have major cross-company initiatives to, e.g., shave a couple bytes off a datagram format just to reduce some message's average latency by a fraction of a millisecond.

Re:Multicore OCaml: Feb 2020 update by lmm on Friday February 28, 2020 @09:42PM (#22448375)
> People write user interfaces in Java so clearly it’s users care about latency.

GUIs in Java are notoriously bad, and tend to only be used for internal tools (where good UX is not a priority), complex professional tools where functionality was a higher priority than UX, or open-source programs where the same thing is true. Another example is that Java is still an unpopular language for command-line tools that can be used from the shell, whereas OCaml is pretty popular in that use space.

Any reasonably popular language will have someone using it for any given thing, sure - I'm sure there are people out there writing webapp backends in C or numerical batch processes in Ruby - but the core constituency can differ a lot between different languages, and that can (and should!) affect that language's priorities.

Re:Multicore OCaml: Feb 2020 update by pjmlp on Sunday March 01, 2020 @05:54AM (#22456318)
Programmer art ,doing everything on the UI thread, and not caring to read books like "Filthy Rich Client" usually are big contributors to that bad experience.

And there is hardly any difference between using something like Swing Material UI widgets or the typical Android app, other than programmer skills.

Re:Multicore OCaml: Feb 2020 update by c-cube on Friday February 28, 2020 @07:12PM (#22447624)
You don't just wave a magic wand and get your code parallelized, though. Some algorithms are quite hard to parallelize (and it seems OCaml's user base is full of these, like theorem provers and compilers). Remember Amdahl's law.
Re:Multicore OCaml: Feb 2020 update by dna_polymerase on Friday February 28, 2020 @12:21PM (#22444372)
But I'd have to adapt my old code to more cores, and it isn't always easy to just split and distribute a workload onto more cores.