HeadlinesBriefing favicon HeadlinesBriefing.com

Typhon proves C# can hit microsecond‑latency ACID databases

Hacker News •
×

Typhon, an embedded ACID database engine written in .NET, targets 1‑2 microsecond transaction commits. The author, a veteran 3D engine developer, chose C# despite common concerns about GC pauses and memory layout. By leveraging unsafe code, pinned buffers, and ref structs, Typhon sidesteps typical managed‑language pitfalls and delivers true transactional safety for high-performance online gaming systems and real-time applications.

The engine tackles garbage‑collection latency by pinning its page cache with GCHandle.Alloc(Pinned), keeping byte arrays at fixed addresses. Unsafe pointers and fixed‑size arrays grant cache‑line alignment, while constrained generics enable monomorphization, eliminating virtual dispatch. System.Runtime.Intrinsics exposes SIMD instructions such as Sse42.Crc32, delivering ~1.3 µs checksums per 8 KB page—on par with native C code for high-performance transactional workloads in game servers today.

Typhon’s page‑cache hot path uses a 16‑slot SIMD search, loading 64 bytes in a single Vector256 operation and falling back to a fast MRU check. Entity reads come through a 96‑byte ref struct, eliminating heap allocations. By marrying low‑level control with a managed ecosystem, the project demonstrates that C# can power microsecond‑latency, ACID‑compliant databases for real‑time engines in game servers.