C++20 / Neural simulation / Performance

A small brain.
A serious systems problem.

FlyBrain runs the wiring of a fruit-fly nervous system. The engineering challenge: make millions of connections efficient to simulate, while keeping every result reproducible.

Personal project · reusable engine v0.2.1

Traced neurons
165,122
Connections
6,235,682
Represented synapses
89,731,551

Start with a reference you can trust

The original engine scans every connection at each timestep. It is deliberately simple and stays in the codebase as a correctness oracle. The faster engine visits the outgoing connections of neurons that fired, using a source-grouped CSR index.

Workers own separate target ranges, avoiding atomic synaptic accumulation. Integer synaptic sums preserve exactness. Each optimized engine and thread count is compared with the reference in lockstep: spike identities, ordering, and every voltage bit must agree.

Input channelsActive neuronsOutgoing connectionsTarget-owned updates

Performance with the context attached

These are historical measurements on an AMD Ryzen AI 9 HX PRO 370, Linux, GCC 13.3.0 Release. Each value is the median of five trial timestep medians, with five warmup steps and 50 measured steps per trial on the full graph.

Wall time per 1 ms model timestep · recorded September 30, 2026
EngineMedian timestep
Reference · edge scan48.52 ms
Active sources · 1 thread5.95 ms
Active sources · 16 threads1.83 ms

CPU affinity and power policy were uncontrolled. These runs describe one machine and workload; they do not establish portable speedups or a new performance result. The 16-thread run remains slower than real time. The downloaded evidence preserves compiler, source hashes, revision, individual trials, and the recorded worktree status.

Download the benchmark evidence (JSON) ↓

A library, with an application you can try

The engine is an installable CMake package with named input/output channels, snapshots, and recorded-input replay. FlyOps consumes that interface and compiles it to WebAssembly. Its dashboard runs a small 256-neuron synthetic fixture, so you can explore it without downloading the full connectome.

The fly responds to telemetry, while explicit rules decide incident severity. Neural activity is a simulation output; it is not a learned operational diagnosis.

Run the incident story →

Close the loop, then test the connection

A separate four-neuron synthetic circuit connects directional inputs to motor spikes and steering. The arena compares native recorded trajectories with a direct rule and a disconnected-circuit control across 18 fixed scenarios. It exercises the installed C++ adapter; it does not use MaleCNS wiring or establish biological behavior.

Explore the sensorimotor arena →

What the model means

The wiring comes from the official Janelia FlyEM MaleCNS v1.0 dataset. Neuron dynamics use a simplified leaky integrate-and-fire model. Neurotransmitter sign mapping, stimulus, and synaptic scale are modeling choices. This does not establish biological equivalence or learning.

Source data: Janelia FlyEM MaleCNS. Dataset attribution: CC BY 4.0. FlyBrain code is MIT licensed; its repository is currently private.

What I want to investigate next

Profile across sparse and broad activity workloads, identify the next expensive path, and test one optimization at a time. Structure-of-arrays state and SIMD are candidates; they earn a place only after correctness checks and same-machine measurements.