3 ms·
I think for people who need absolute performance, manual memory management seems inevitable. No amount of GC tuning or hacks (such as the wonderful compact regi
by kccqzy 6y ago
I think for people who need absolute performance, manual memory management seems inevitable. No amount of GC tuning or hacks (such as the wonderful compact regions) would be satisfactory.
This enables more kinds of programs to be written in Haskell, whereas your day-to-day typical server programs can just use GC as they currently do.
- pjmlp 6y agoIf one needs absolute performance, then their only option is bare metal, as the OS can also induce every kind of delay, including RTOS, so manual == performance goes a long way until it is actually true.
- AlotOfReading 6y agoThere's a pretty wide area between the current situation and completely bare metal, a gap wide enough to fit the vast majority of performance sensitive applications today. It's not like you have to stop at bare metal either in a world as the hardware can introduce some latency on its own. You really need an FPGA or ASIC to take this to its logical conclusion.
- pjmlp 6y agoJust like exists a gap between allocating memory like crazy, and taking care where it is allocated from, and what kind of data structures are used before assuming that malloc()/free() are faster than the alternatives without taking into consideration what happens between calling them and the kernel round-trip that takes place. So, while Haskell isn't D or Nim, there also also more than just one way to allocate memory when performance fine tuning is called for. And yes, in Fintech that is exactly what they do, reach out for FPGAs and measure cable lengths as well, while on high integrity computing all allocations are static, either at compile time or as part of the application startup, nothing else is allowed.
- nine_k 6y agoA unikernel library could put your key process front and center, only providing a unified way to access the hardware. Things become more interesting when you start to need concurrency. You can of course do it manually, too, controlling every fiber switch (I've seen this done in an engine controller, where all the computatios should complete within one rotation of the shaft.)
- kccqzy 6y agoFunny how you mentioned unikernel. There's a Haskell unikernel whose development began more than a decade ago: https://github.com/GaloisInc/HaLVM https://github.com/GaloisInc/HaLVM
- danielscrubs 6y agoA hot take: I'd argue that in that case Haskell is not the right tool for the job, anything with assembler support is (C++/Rust). Haskell is still awesome in doing practical computer science and an eye opener in the power of types, but you are going to throw most of the power away of you start to rely on things that are not formally verified. As soon as you are in "this is semi-correct and semi-defined" you might as well use another tool and let Haskell try to focus on the "100% correct, given x,y and z"-crowd. I know, I know this is a very simplified view, and it's not 100% correct, but that is what I want Haskell to strive for.
- moomin 6y agoThe thing is, Haskell's pretty much the only language with anything approaching a "sufficiently smart compiler". And it performs its optimisations by having a great deal of knowledge it gets from the type system. No, it isn't faster than Rust, but it's an open research problem and I think it's awesome people are still working on it when most platforms have given up. Besides, it turns out that linear types are useful _without_ performance optimisations: they're very good for modelling state machines e.g. socket lifecycles.
- danielscrubs 6y agoI agree