3 ms·
This is one of my favorite innards-of-Haskell articles. It's such an intuitive way to look at how a super high level language like Haskell gets down to machine
by LukeHoersten 12y ago
This is one of my favorite innards-of-Haskell articles. It's such an intuitive way to look at how a super high level language like Haskell gets down to machine primitives. So important for optimization too.
I've been in HFT for a while and what strikes me is the performance optimizations you make in C++, Java, and Haskell are actually so so similar. Get down to the primitives. Avoid boxing. Avoid memory allocation at run time. Makes me think any language can be performant if you know what you're doing.
- zura 12y agoExactly. And optimized Haskell doesn't quite look to "that beautiful FP language" anymore, but becomes more imperative.
- Dewie 12y agoIs this where someone points out the more functional intermediate SSA that imperative languages often get translated into at some point during the compilation?
- deleted 12y ago[deleted]
- LukeHoersten 12y agoI was thinking more stream fusion and rewrite rules etc. GHC is a lot more powerful in that sense than the other language compilers I mentioned. A lot of it in Haskell just boils down to bang patterns on data types. And where it does get messy as you suggest (yeah it does), you can nicely abstract it away behind a pure library interface. That way the mess is encapsulated.
- codygman 12y agoYou know how people use Python for most of their code and write c bindings for performance intensive parts? Idiomatic Haskell for most of my code and imperative Haskell for performance achieves something similar without having to switch languages. If you really need C, Haskell also makes it pretty easy as well.