The latency of Quent's instrumentation calls is already very low since it immediately moves the event into a queue to be processed in a background thread. Quent instrumentation is not really meant to be added to critical paths, and instrumentation placement is completely managed by application developers, so significant overhead is directly manageable. Still, we can learn from some awesome state-of-the-art projects like Quill that sport insanely low latency for their instrumentation (in this case logging) calls.
In a vibe coded experiment I've added more microbenchmarks, comparing against some other well-known (mostly (structured) logging) frameworks, and tried to apply some of the optimizations seen in Quill. Most notably this includes the x86 TSC approach which e.g. the quanta Rust crate provides (except Quill's periodic resync which i think we'd want as well for accuracy), and using the SPSC TLS queue. This resulted in the following:
(quent baseline: 5597b89)
(Branch on my fork: https://github.com/johanpel/quent/tree/vibe/bench-versus-experiment)
Since these optimizations touch an incredibly critical section of Quent's generic instrumentation library infrastructure, I propose carefully and incrementally adding these improvements to match the performance of the state-of-the art.
I propose the following steps:
1: add a non-vibe coded microbenchmark setup including the vs. measurements so people have a point of comparison against things they might know already
2: leverage x86 TSC. There is a roughly equivalent approach for ARM too
3: implement a similar SPSC TLS approach
4: more micro-optimizations if we're still not in the same ballpark as SOTA.
The latency of Quent's instrumentation calls is already very low since it immediately moves the event into a queue to be processed in a background thread. Quent instrumentation is not really meant to be added to critical paths, and instrumentation placement is completely managed by application developers, so significant overhead is directly manageable. Still, we can learn from some awesome state-of-the-art projects like Quill that sport insanely low latency for their instrumentation (in this case logging) calls.
In a vibe coded experiment I've added more microbenchmarks, comparing against some other well-known (mostly (structured) logging) frameworks, and tried to apply some of the optimizations seen in Quill. Most notably this includes the x86 TSC approach which e.g. the
quantaRust crate provides (except Quill's periodic resync which i think we'd want as well for accuracy), and using the SPSC TLS queue. This resulted in the following:(quent baseline: 5597b89)
(Branch on my fork: https://github.com/johanpel/quent/tree/vibe/bench-versus-experiment)
Since these optimizations touch an incredibly critical section of Quent's generic instrumentation library infrastructure, I propose carefully and incrementally adding these improvements to match the performance of the state-of-the art.
I propose the following steps:
1: add a non-vibe coded microbenchmark setup including the vs. measurements so people have a point of comparison against things they might know already
2: leverage x86 TSC. There is a roughly equivalent approach for ARM too
3: implement a similar SPSC TLS approach
4: more micro-optimizations if we're still not in the same ballpark as SOTA.