Jane Street: We "fight at a fundamental disadvantage" by using OCAML over C++
One of the big advantages for developers looking for a job at Jane Street (besides the pay, of course) is its use of the programming language OCAML rather than the industry standard C++. However, while OCAML has a cult following for its ease of use, it has plenty of drawbacks in an ultra-low-latency context, as illustrated by Google staff engineer-turned Jane Street developer Andrew Hunter on Ron Minsky's Signals and Threads podcast.
"Anyone can write fast C++, but it takes a real expert to write fast OCAML," Hunter says. "You can't fire me." The reason for this is that the language prominently features garbage collection. Using this results in uninitialized data being inspected at runtime, which "can be really problematic." Developers that want to match C++ speeds have to use "little weird corners of the language that are slightly less pleasant to use, but will give you more control."
Garbage collection is most often associated with Java, which is a notoriously difficult language to use for HFT. Hunter says OCAML's edge against it is "interoperability," particularly with C. "We have these little C stubs that we can call into, and it's really cheap [memory-wise]. It's not like Java."
While he says it's "easy to write good, clean, safe code," OCAML has a "very boxy" and organized representation of the world with an abundance of pointers. C++ meanwhile is a highly efficient mess where everything "would just be splattered right there in the middle."
Hunter says "we fight at a fundamental disadvantage" using OCAML, but Jane Street is working hard to change the tide. He says that the "biggest change that maybe will ever happen in the compiler" is increasing the coder's control over OCAML types. Previous podcast guest Richard Eisenberg has been instrumental in expanding the type capabilites of the language. The inherent disadvantages aren't a problem to Hunter, however; he says "we just have to work hard, and we have to think more."
So why use OCAML when a 'better' alternative is right there? Hunter posits that C++ developers are doing the same thing by using C++ instead of engineering with hardware like FPGAs and GPUs. He says, "nothing's ever going to be as fast as hardware, but it's really hard to write hardware." Hunter has committed the "personal sin" of never coding in Verilog (a language frequently used for hardware), but says he's "reliably informed that it is miserable and unpleasant and your compiler takes 24 hours to run." It's not always a matter of enjoyment, however; Hunter says some of Jane Street's most complex strategies are "flatly impossible" to implement using hardware.
Click here to create a profile on eFinancialCareers. Make yourself visible to recruiters hiring for top jobs in technology and finance.
Have a confidential story, tip, or comment you’d like to share? Contact: +44 7537 182250 (SMS, Whatsapp or voicemail). Telegram: @SarahButcher. Click here to fill in our anonymous form, or email editortips@efinancialcareers.com. Signal also available.
Bear with us if you leave a comment at the bottom of this article: all our comments are moderated by human beings. Sometimes these humans might be asleep, or away from their desks, so it may take a while for your comment to appear. Eventually it will – unless it’s offensive or libelous (in which case it won’t.)