News for hackers. Stuff that matters.
Re:Go 1.18 Beta 1 is available, with generics by fsdjkflsjfsoij on Wednesday December 15, 2021 @11:21AM (#29568025)
> Plenty of languages inline map/reduce or iterator type code down to very efficient cache-friendly traversal of memory

Very few languages outside of Rust and Haskell actually do this reliably and that's including languages like Ocaml and F#. Rust and Haskell are certainly the only even remotely popular languages that do it.

Re:Go 1.18 Beta 1 is available, with generics by spekcular on Wednesday December 15, 2021 @11:28AM (#29568123)
Does Haskell actually succeed here?

This is perhaps not the right way to measure, but: When I last checked the programming language benchmark game [0], the Haskell submissions were basically as fast as C/C++/Rust. But, this came at the cost of writing non-idiomatically/non-functionally – essentially abusing the language to write C in Haskell. I would be curious how well "idiomatic" Haskell compares to C++/Rust, in terms of the compiler optimizing away the functional abstractions.

[0] https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re:Go 1.18 Beta 1 is available, with generics by igouy on Wednesday December 15, 2021 @11:49AM (#29568407)
Re:Go 1.18 Beta 1 is available, with generics by spekcular on Wednesday December 15, 2021 @12:14PM (#29568791)
Thanks, that's pretty convincing.
Re:Go 1.18 Beta 1 is available, with generics by Zababa on Wednesday December 15, 2021 @03:31PM (#29571243)
I think OCaml can do it with flamba, at least that's what this library readme says: https://github.com/c-cube/iter

> with flambda under sufficiently strong optimization flags, such compositions of operators should be compiled to an actual loop with no overhead!

Re:Go 1.18 Beta 1 is available, with generics by nine_k on Wednesday December 15, 2021 @12:46PM (#29569194)
Does the elephant-in-the-room of C++ do it? I thought it does.

I can't bet on what Java and JavaScript JITs make of map / forEach / filter / reduce, but I suspect that they can be pretty efficient, given the clear delineation and the repeated patterns.