Hacker News new | ask | show | jobs
by dig1 1339 days ago
> People said you can’t write a financial trading system in a garbage collected language

People have been writing HFT systems in GC languages (Java, OCaml) for a while, and as you mentioned, you need to know when to pause/unpause/prevent collection in the critical section.

This [1] is an excerpt from a talk with Dave Lauer [1], who has done it in Java - it took his system ~40 μs from receiving data to producing market order, and he explains in great detail what amount of work the system had to do. And this was >10 years ago.

[1] https://youtu.be/1ah7XokvcwA?t=785

2 comments

> you need to know when to pause/unpause/prevent collection in the critical section.

That's his point. It's like saying humans can walk over a lake, as long as it's dry season and the lake is now 10 inches deep.

You can use garbage collected languages as long as you don't collect. (!?!?!)

I'm even more hardline. IMO everything time or life-critical should have static memory allocation, period.

sub 10 in Java was very doable 10 years ago, fwiw. even better than collecting once a day is doing everything off-heap — C-style java :D
Just keep your objects live, attach reusable scratch space to them, and memory pool them instead of throwing them away.

(from my experience anyway in writing critical-path allocation-free C# with Unity).

ya, also keep everything in cache to be below a few mics