Things I built because I was curious what happens when you push code right up against the silicon.
Low-Latency-Lab
I take my old projects and re-engineer them with everything I've learned about how the hardware
actually works. Each one gets profiled with perf stat/record, then optimized at
the instruction and cache-line level until the CPU is the bottleneck instead of my code. AVX2 SIMD,
io_uring async I/O, lock-free queues, O_DIRECT, CPU pinning, PGO — the full toolkit. This is where I
learn by breaking things and measuring what happens.
I wanted to know not just how fast my code was, but why it was slow. So I built a
library that talks directly to the CPU's performance monitoring unit — retired instructions, cycles, IPC,
cache misses, TLB misses — all captured at single-cycle resolution using RDTSCP. No sampling, no
interpolation, just raw hardware truth.
Rebuilt from my earlier Python+assembly version into a pure-C multi-process pipeline. io_uring for async
I/O, lock-free Vyukov MPMC queues for cross-process chunk dispatch, AVX2 SIMD for two-block parallel
encryption, O_DIRECT to bypass the page cache. 5 workers pinned to physical cores, PGO-compiled.
1.44 GB/s on a 6-core AMD Ryzen 4600H — and every percent of that was earned the hard
way. Read the story
→
Ported my cipher to NVIDIA CUDA to see how GPU throughput compares to CPU latency. Coalesced memory
access, dynamic thread-block tuning, benchmarked against CPU baselines. The answer: it depends, and the
trade-offs are fascinating.
The single-threaded reference cipher that TeraCrypt's crypto core is built on. 1024-bit (128-byte) blocks (32×32
bit matrix), 8 rounds of per-lane rotation + XOR + bit-matrix transpose. AVX2 intrinsics for in-register
operations, PGO-compiled. Went from 5 minutes per GB in the
original implementation
to 0.4 GB/s — roughly an 11,900% improvement. Cross-verified: files encrypted by either
version decrypt correctly with the other.
My cipher, rewritten entirely in x86-64 assembly. Register-level control, manual calling conventions,
loop unrolling — no compiler between me and the metal. Built for both Linux and Windows, because
portability matters even when you're hand-coding instructions.
Post-quantum cryptography doesn't have to be intimidating. I built a cross-platform app with Rust + Slint
that integrates ML-KEM-1024, HQC-256, SLH-DSA, and the usual symmetric suspects for quantum-resistant file
encryption. Won Best Final Year Project 2024 at PES University.