Discover your dream Career
For Recruiters

Jane Street: We "fight at a fundamental disadvantage" by using OCAML over C++

OCAML: The language with a "boxy" view of the world

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 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.)

AUTHORAlex McMurray Editor
  • Bo
    Bob Morane
    12 December 2023

    I usually find Jane Street podcast a bit dull, but I have to name the article (link at the end), because it is mostly not about a petty war language 1 vs language 2.

    The article is about performance engineering, and explains some of the things to look for (unfortunately, not a details great enough).

    For example, about "chasing heap alloc" which can impact seriously performances. Memory allocations are often neglected by most people and is often an important cause of slowness, from big fat quant libraries to "fast" trading engine.

    I think most people would gain listening to the pod (or read the transcript).

  • Mo
    6 December 2023

    Jane street is very hyped as a quant dev destination. Clearly a difference between the story and the reality if their principal dev language doesn't even natively support multithreading. If you are a) serious b) intelligent then avoid John Road.

  • rj
    1 December 2023

    That felt like reading "The Onion" article.

  • Lo
    1 December 2023

    I dont usually comment on articles (especially not finance-related ones) but there is enough nonsense here that you have successsfully nerd-sniped me... congrats?

    Uninitialised memory isn't a problem with garbage collection - one if the main benefits of garbage collection is it can help make language memory-safe, making reading from uninitialised memory impossible! GC also doesn't remove unused code (that would be called dead-code elimination, which something basically any optimising comliler for any language will try to do), it deallocates unused data. It's this keeping track of which memory is uninitialised and which is in use that makes GC to be slow.

    Further, Richard Eisenberg definitely did not add dependent types to OCAML lol. You probably mean unboxed types (which are intended as a dirext solution to the overhead in OCAML caused by all values being boxed, at the coat of values if thise types being mire awkward to program with). Richard Eisenberg *did* do a lot of work towards adding delendent types to Haskell, but much of that project still has not materialised and even before joining Jane Street he was more focussed on ither type system features (like unboxed types, linear types, existential types etc...). I'm nit super knowledgable about Quant, but I suspwct Jane Street would not get *too* much benefit from dependent types given their main proven application is proving code is correct (eliminating bugs), with associated large burden on the programmer to write the proofs - not performance (in fact, implemented naively, dependent types can be quite devastatibg for performance - i.e: if, like in Haskell's current pseudo-dependent types you aren't able to erase the proofs from the final program).

Sign up to Morning Coffee!

Coffee mug

The essential daily roundup of news and analysis read by everyone from senior bankers and traders to new recruits.

Boost your career

Find thousands of job opportunities by signing up to eFinancialCareers today.
Recommended Articles
Recommended Jobs

Sign up to Morning Coffee!

Coffee mug

The essential daily roundup of news and analysis read by everyone from senior bankers and traders to new recruits.