Re:Haskell for a New Decade [pdf]
by chrisseaton on Wednesday June 24, 2020 @06:45AM
(#23626402)
But Java doesn't do stream fusion as you're describing.
It does conventional inlining and combining loop bodies, which can in some trivial cases achieve the same effect, but these are techniques you'd find in any compiler or even an 80s text book - they didn't come from Haskell.
Here's the limitation of Java's 'fusion' - you'll notice there's no pass to do this in Hotspot - it just happens due to the inlining and GCM passes.
https://github.com/openjdk/jdk/blob/883a4f65b9b1533c8a51d156...
And here's a paper on trying to add actual Fusion to Java, which they wouldn't be doing if Java had it already.
https://dl.acm.org/doi/pdf/10.1145/3355378.3355386?download=...
[1] http://fun.cs.tufts.edu/stream-fusion.pdf