Heykuki News

TopNewBestAskShowJobs
TopNewBestAskShowJobs
Show HN: Fastlog – Async C logging with thread-local hot path
github.com/j91981274-sudo
1 point
Hariom5
4 months ago
Hi HN,

I built fastlog, a small asynchronous logging library written in pure C.

The goal was predictable logging performance under multi-threaded load. Traditional approaches (fprintf, mutex-per-log designs) tend to block or scale poorly when many threads log at once.

fastlog uses: - a background writer thread - batching instead of per-log synchronization - thread-local buffers on the hot path (no locks per log call)

On a 4-core Intel i3 system: - single-thread performance is competitive with fprintf - multi-thread logging scales ~1.6× better under contention - syscall profiling shows ~90% fewer futex calls compared to lock-heavy designs

It’s a single .c/.h pair, no dependencies, easy to embed.

Happy to answer questions or hear feedback.