Personal blog

Hi, I'm Jasper

low-latency C++algorithmsAI-native

Latest

Recent posts

View archive
Common Bottlenecks and Optimizations #21 13 min read

Measuring Trading-System Performance

What TTT and RTT each cover, why to report p50, p99 and p999 instead of the mean, how marks at thread boundaries separate processing from queueing, and how to use the latency table as a budget.

Low-Latency Systems Development #20 25 min read

Measuring Latency with the TSC

What a TSC reading means, when it is taken, which core it is taken on, how to record timestamps on the hot path, and how ticks become ns: where the frequency comes from and how to calibrate it yourself.

Hands-on Practice #18 16 min read

Thread-Safe Queues

From one mutex to many producers: condition variables and lost wakeups in a blocking queue, rte_ring’s two pairs of indices and in-order publishing, Disruptor’s availability flags, and whether a full queue should block, drop, or …

Low-Latency Systems Development #17 14 min read

Wait-Free

Wait-free is not a faster lock-free: it turns a failed CAS from “try again” into “I come after you”, which bounds every thread’s steps, at the cost of more atomics and code that is harder to get right.

Common Bottlenecks and Optimizations Topic 23 min read

perf: How to Use It, What to Read

stat for the totals, record and report to find the function holding 98% of the samples, annotate to see every sample land on the instruction after an add: a chain of adds, each waiting for the last, and splitting it four ways is …

Low-Latency Systems Development #16 35 min read

Spinlocks

Whether a spinlock is fast depends on what its waiters do: if every attempt is a read-modify-write, they drag the lock’s line back and forth. Read before you grab, put PAUSE in the loop, back off after losing, and waiting costs …

Low-Latency Systems Development Topic 22 min read

A Cache Case Study: Repricing 64 Options per Tick

One tick touches 140 cache lines, and most of the time goes into waiting for them. None of the four steps changes the computation; they change when data arrives, where it lands and who holds it: put the misses in flight together, …

Low-Latency Systems Development #8 22 min read

CRTP and Static Polymorphism

The base class writes the flow and the subclass fills in the details: virtual functions pick the subclass at run time, CRTP at compile time. What you save is more than one indirect jump: the call inlines completely and the object …