A small low-latency systems project built around a simple idea: a server streams matrix-multiplication challenges, and the client must parse, compute, and answer as fast as possible.
The challenge message format is:
challenge_id
N
A (N*N integers)
B (N*N integers)
The client replies with:
challenge_id checksum
where checksum = sum(A * B) mod 997.
hftserver2026/: reference server for local testingtools/blast_server.cpp: stress server with configurable rate, matrix size, window, and burst modeshftclient2026/main.cpp: current optimized clienthftclient2026/main_v1.cpp,main_v2.cpp,main_v3.cpp: earlier client iterations kept for comparison
The current client focuses on low latency under load:
- streaming parser over a circular buffer
- flat matrix storage
- parallel compute workers
- dynamic tile scheduling
- cache-friendly tiled multiplication
- deferred modulo to remove
% 997from the inner hot loop - macOS compute-thread QoS
- socket tuning with
TCP_NODELAYand larger receive buffers - built-in benchmark mode
In local testing, the biggest performance win came from deferred modulo, followed by better worker scheduling and tile sizing.
v1: first correct client, fixed TCP stream parsing and basic checksum computationv2: introduced a receive/parser/compute pipeline and worker threadsv3: improved compute with tiling, cache-friendly loop order, and benchmark instrumentationv4(main.cpp): benchmark-driven tuning of worker count, tile size, ring buffer size, deferred modulo, prefetching, and macOS scheduling hints
Build with CMake:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j8Start the reference server:
./build/bin/hftserver2026Run the optimized client:
./build/bin/hftclient2026 127.0.0.1 12345 TeamARun with benchmark summary:
./build/bin/hftclient2026 127.0.0.1 12345 TeamA --benchmarkExample blast-server run:
./build/bin/blast_server --rate 200 --window 10 --size 128 --mode 1The current client was tested against:
- high message rates
- burst / overlap traffic
64x64,128x128,256x256, and512x512matrices
and remained correct and stable in those local runs.