---
title: "Writing a DSL for high performance parallel programming in OxCaml"
description: "A Jane Street intern built a JIT compiler for an SPMD-style DSL in OxCaml so SIMD kernels for options pricing and risk checks can be written once as ordinary-looking OxCaml functions instead of architecture-specific C intrinsics."
url: "https://swe.quest/articles/writing-a-dsl-for-high-performance-parallel-programming-in-oxcaml-5f7bd51c2038a2c3"
canonical: "https://blog.janestreet.com/writing-a-dsl-for-high-performance-parallel-programming-in-oxcaml/"
source: "Jane Street Tech Blog"
published: "2026-11-06"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 17
tags: ["compilers","functional-programming","language-design","performance","hardware"]
---

# Writing a DSL for high performance parallel programming in OxCaml

A post on [Jane Street Tech Blog](https://swe.quest/sources/jane-street.md), published 2026-11-06, 17 min read, Deep dive. Original: [https://blog.janestreet.com/writing-a-dsl-for-high-performance-parallel-programming-in-oxcaml/](https://blog.janestreet.com/writing-a-dsl-for-high-performance-parallel-programming-in-oxcaml/)

## Summary

A Jane Street intern built a JIT compiler for an SPMD-style DSL in OxCaml so SIMD kernels for options pricing and risk checks can be written once as ordinary-looking OxCaml functions instead of architecture-specific C intrinsics. Kernels describe the computation for a single output index, and the compiler generates the loop, which keeps each iteration writing exactly one output and makes vectorization safe. The front end builds a GADT-typed DAG that tracks uniform vs. varying rates and provides three control-flow forms (select, if\_, if\_var) with different evaluation semantics. The backend uses OxCaml's runtime metaprogramming (quotes and splices) to emit OxCaml code, partially evaluating runtime-known values such as the chosen distance metric away and relying on the OxCaml compiler for further optimization.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Compilers](https://swe.quest/tags/compilers.md) (Compilers & runtimes)
- [Functional programming](https://swe.quest/tags/functional-programming.md) (Languages)
- [Language design](https://swe.quest/tags/language-design.md) (Compilers & runtimes)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Hardware](https://swe.quest/tags/hardware.md) (Infrastructure)

## Prerequisites

- OCaml syntax and GADTs ([easy posts on Functional programming](https://swe.quest/tags/functional-programming.md?difficulty=easy))
- SIMD vectorization
- JIT compilation basics ([easy posts on Compilers](https://swe.quest/tags/compilers.md?difficulty=easy))
- CUDA or ISPC programming model

## Keywords

OxCaml, SPMD, SIMD, ISPC, CUDA, runtime metaprogramming, GADT

## Related posts

- [What the interns have wrought, 2025 edition](https://swe.quest/articles/what-the-interns-have-wrought-2025-edition-eda7f47e78fb3ca5.md): Jane Street Tech Blog · 2025-08-27 · Hard · 12 min read · Functional programming, Memory management, Query engines, Type systems, Performance engineering
  Jane Street's 2025 intern projects include an index-aware evaluator for JSQL, the company's internal SQL dialect, which over-approximates key ranges from WHERE clauses and specializes execution to Map, Hashtbl or multi-index containers, giving ~700x and ~30x speedups on 3.8M-row benchmarks.
- [What the interns have wrought, 2021 edition](https://swe.quest/articles/what-the-interns-have-wrought-2021-edition-0f76a8f694a74c7c.md): Jane Street Tech Blog · 2021-08-09 · Medium · 10 min read · Functional programming, Engineering culture, Developer tools, Observability
  Jane Street's 2021 dev internship (87 interns across New York, London and Hong Kong) is showcased through three projects.
- [What the interns have wrought, 2023 edition](https://swe.quest/articles/what-the-interns-have-wrought-2023-edition-f070c30cff9e3c3e.md): Jane Street Tech Blog · 2023-09-12 · Medium · 9 min read · Functional programming, Observability, Developer tools, LLMs, Concurrency
  Three Jane Street intern projects, all in OCaml. The first is an SQL-like temporal query language, parsed with Angstrom and compiled onto a Linear Temporal Logic engine, for finding event sequences in Concord's transaction stream.
- [What the interns have wrought, 2024 edition](https://swe.quest/articles/what-the-interns-have-wrought-2024-edition-b9d6cc4b73c67320.md): Jane Street Tech Blog · 2024-08-26 · Medium · 12 min read · Functional programming, Performance engineering, Debugging, Event-driven architecture, Analytics & OLAP
  Three 2024 Jane Street intern projects get a technical walkthrough.
- [ICFP 2024](https://swe.quest/articles/icfp-2024-a2b848db9d4cf383.md): Jane Street Tech Blog · 2024-08-29 · Hard · 8 min read · Functional programming, Type systems, Language design, Memory management, Compilers
  Jane Street's OCaml Language team brings nine papers and talks to ICFP 2024 and describes its compiler-branch extensions: modal types (modes like local and unique) for Rust-like control over allocation and data-race-free parallelism, and a kind system for unboxed layouts.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
