Hacker News new | past | comments | ask | show | jobs | submit login

Pretty sure F# allocates like nobody's business



By default yes, but that's the price of using immutable objects and datastructures.

However, you can cut pretty much all of those allocations with a bit of care and still retain some F# niceties.

I recently wrote a very low allocation text file parser that could ingest log files at over 200MB/s single threaded. All in F# using structs and Span the same way I would in C#.

Except I get the safety, terse syntax and rigor of options, records and matches


That's pretty cool. I wish some of the foundational f# libs and webserver were written that way. They probably use more idiomatic code which means application code pays those costs too.


For years, a lot of pain was caused by F# using classes for critical types such as Option, Tuple and Choice. Additionally most records should have been structs by default.

They have started fixing this by introducing value tuple, value option and supporting C# performance primitives like Span. But they have a way to go still.


Ah, that summary is helpful, thanks


f# is multiparadigm and can do same low level as c#. you can not to allocate if do not want so.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: