C++17 • Header-Only • MIT License

loon

High-performance data structures for latency-critical C++ applications.

A lightweight, header-only library with zero external dependencies. Drop-in STL replacements optimized for cache efficiency, low memory footprint, and real-time systems.

Install
git clone https://github.com/jsrivaya/loon.git
#include <loon/ring_buffer.hpp>
#include <loon/lru.hpp>
#include <loon/spsc.hpp>

// Lock-free ring buffer — O(1) push/pop
loon::RingBuffer<int, 1024> buffer;
buffer.push(42);
auto val = buffer.pop();

// LRU cache — O(1) get/put
loon::LRUCache<std::string, int> cache(100);
cache.put("key", 99);

// SPSC queue — lock-free, wait-free
loon::SPSCQueue<double, 4096> q;
q.try_push(3.14);

Why loon?

Blazing Fast

Benchmarked against STL — faster insertion, lookup, and iteration. Optimized memory layout with SoA, pooling, and alignment.

🎯

Zero-Cost Abstractions

Header-only with no external dependencies. No dynamic allocation on critical paths. Ideal for real-time and embedded systems.

🔌

STL Compatible

Drop-in replacements with familiar interfaces. Swap out std:: types and immediately benefit from better performance.

📦

Just Include It

Copy a header, include it, done. No build system changes, no linking, no configuration. C++17 and above.

Built for

HFT

High-frequency trading systems where every nanosecond counts

Gaming

Game engines and real-time simulations with tight frame budgets

Embedded

Resource-constrained systems with strict memory and latency requirements

Robotics

Real-time processing pipelines for sensor data and control loops

Ready to dive in?

Get started with loon in under a minute. Header-only means zero friction.