Production data has shape. Timestamps arrive in order. Geometry clusters. Logs share prefixes. Lattices repeat. NS products are built around that structure. The benchmarks reflect it: wins are consistent on structured workloads, losses on random distributions are documented. Random data does not exist in production.
Arena allocator with bulk-reset optimization
| Pattern | NS (ns/op) | mimalloc (ns/op) | Speedup |
|---|---|---|---|
| Bulk Reset (NSMultiPool) | 113.8 | 967.2 | 8.5x |
| Fixed-Size Hot Path (NSPool<64,64>) | 2.59 | 3.33 | 1.3x |
g++ -O3 -march=native -std=c++17 alloc_bench_final.cpp -o bench && ./bench
Bounding volume hierarchy for ray tracing
1.37x-1.44x Embree on clustered/mixed scenes. Win condition: structured/clustered geometry: the majority of production workloads.
| Scene Type | NS (ms) | Embree (ms) | Speedup |
|---|---|---|---|
| Sparse Clustered (20 clusters) | 7.16 | 9.82 | 1.37x |
| Mixed (10 clusters + 5K random) | 9.12 | 13.11 | 1.44x |
| Dense Uniform (10K random) | 6.96 | 4.38 | 1.59x Loss |
g++ -O3 -march=native -std=c++17 nsbvh_bench.cpp -o bench && ./bench
LRU cache with hot tier protection
| Workload | Size | NSCache | LRU | Speedup |
|---|---|---|---|---|
| Random | 131K | 66.24 | 237.49 | 3.58x |
| Sequential | 1M | 135.23 | 88.78 | 0.66x (hashing overhead) |
g++ -O3 -march=native -std=c++17 bench_nscache.cpp -o bench && ./bench
Schema-aware game data compression
| Compressor | Ratio | Decompress (ms) | Speedup |
|---|---|---|---|
| NSComp | 7.54x | 0.89 | 29x vs zstd |
| zstd | 7.26x | 25.8 | - |
| LZ4 | 3.97x | 9.66 | - |
g++ -O3 -march=native -std=c++17 nscomp_bench.cpp -o bench && ./bench
Sparse FFT with frequency recovery, comparing against FFTW3
N=1,048,576 (1M samples). 1000/1000 recovery rate at all K.
| K | NSFFT (ms) | FFTW (ms) | Speedup |
|---|---|---|---|
| 5 | 0.036 | 29.2 | 811x |
| 10 | 0.923 | 29.2 | 31.6x |
| 20 | 0.954 | 29.2 | 30.6x |
g++ -O3 -march=native -std=c++17 nsfft.cpp -o bench && ./bench
FIX protocol parser with AVX2 SOH/EQ dual-scan
| Test | NS (msg/sec) | QuickFIX (msg/sec) | Speedup |
|---|---|---|---|
| Full engine (mmap+sessions+recovery) | ~8.5M | 452K | ~18.8x |
g++ -O3 -march=native -mavx2 -std=c++17 bench_nsfix.cpp -o bench && ./bench
Community-structured graph reordering for locality
| Graph | NS (ms) | Standard (ms) | Speedup |
|---|---|---|---|
| Graph C (reordered) | 107.4 | 266.0 (scrambled) | 2.48x |
g++ -O3 -march=native -std=c++17 nsgraph_bench.cpp -o bench && ./bench
Open-addressing hash map optimized for structured keys
11.76x vs absl::flat_hash_map (timestamp lookup). Cold-run medians, 1M keys.
| Distribution/Test | NS (ns/op) | absl (ns/op) | Speedup |
|---|---|---|---|
| Timestamp | 1.62 | 19.09 | 11.76x |
| Sequential | 8.52 | 19.38 | 2.28x |
| Bounded | 1.19 | 10.14 | 8.53x |
| Sequential insert (1M keys) | 7.04 ms | 30.0 ms | 4.26x |
Sequential insert: 4.26x absl | 101x fph | 3.1x std, 142.0M ops/s.
g++ -O3 -march=native -std=c++17 bench.cpp -o bench && ./bench
Spatial indexing with hybrid prediction dispatch
| Operation | NS (ns) | Competitor (ns) | Speedup |
|---|---|---|---|
| Predecessor | 2.0 | 71.9 (lower_bound) | 35.6x |
| Successor | 2.9 | 71.3 (lower_bound) | 24.5x |
| Insert | 28.4 | 243.1 (std::map) | 8.6x |
g++ -O3 -march=native -std=c++17 nsindex_bench.cpp -o bench && ./bench
Reader-writer lock with AVX2 SIMD writer scan
| Scenario | NSRWLock | std::shared_mutex | Speedup |
|---|---|---|---|
| Pure read (256t, 100% readers) | 25.42M ops/s | 11.12M ops/s | 2.29x |
| Mixed 95/5 (8t pinned) | 7.17M ops/s | 5.00M ops/s | 1.43x |
100M ops, pinned cores 0-7. Headline: 2.29x under pure-read load.
g++ -O3 -march=native -mavx2 -std=c++17 lock_bench.cpp -o bench && ./bench
Block-diagonal matrix operations with AVX-512
3.3x Eigen at B=1,000 blocks. Win condition: block-diagonal structure declared by caller.
| Blocks | NS (ns/block) | Eigen (ns/block) | Speedup |
|---|---|---|---|
| B=1,000 | 80.64 | 266.32 | 3.30x |
| B=10,000 | 157.64 | 363.51 | 2.30x |
| B=100,000 | 171.70 | 353.10 | 2.06x |
g++ -O3 -march=native -std=c++17 bench_nsmatrix.cpp -o bench && ./bench
3D mesh compression with parallelogram prediction
| Compressor | Size (bytes) | Encode (ms) | Speedup |
|---|---|---|---|
| NSMesh (Para+Delta+Zlib) | 67,286 | 25 | 18.1x encode vs Draco |
| Draco cl 10 | 160,626 | 453 | - |
g++ -O3 -march=native -std=c++17 mesh_bench2.cpp -o bench && ./bench
Hierarchical TSP solver for routing problems
| Cities | NS (μs) | 2-opt (μs) | Speedup |
|---|---|---|---|
| 20,000 | 49,727 | 17,777,548 | 357x |
g++ -O3 -march=native -std=c++17 optimize_bench.cpp -o bench && ./bench
Transparent filesystem compression for mixed file types
| File type | Best alternative | Alt ratio | NSPack ratio | Format preserved |
|---|---|---|---|---|
| SQLite databases | gzip | 1.8x | up to 3914x | YES (.sqlite) |
| HDR / EXR images | OpenEXR DWAB | ~6x | 25x | YES (.hdr / .exr) |
| 3D mesh (procedural) | Draco (Google) | ~5x | 8.82x | YES (.obj / .ply) |
| 3D mesh (OBJ / PLY) | Draco (Google) | ~5x | 7.84x | YES (.obj / .ply) |
| Point clouds / LiDAR | LASzip | ~3x | 5.68x | YES (.ply) |
| Source code (AST) | gzip | 1.2x | 5.01x | YES (.py / .cpp) |
| BVH animation | gzip | 1.5x | 4.35x | YES (.bvh) |
| Scientific arrays | gzip | 1.05x | 4.13x | YES (.bin) |
| ELF binaries | gzip | 1.06x | 2.90x | YES (executable) |
| WAV audio | FLAC (lossless) | 5x | 2.31x | YES (.wav) |
| PNG / JPG images | WebP | ~1.3x | 1.56x | YES (.png / .jpg) |
| Pre-compressed (MP4, ZIP) | N/A | 1.00x | 1.00x | YES (pass-through) |
nspack mount ~/assets ~/assets-store && nspack status ~/assets
Linux / macOS (FUSE3), Windows (WinFSP)
Analytic QCD from first principles: no lattice, no GPU, no free parameters
| Observable | NSQCD | Measured | Error | Status |
|---|---|---|---|---|
| m_gap (glueball) | 1.535 GeV | 1.500 GeV | 2.3% | <5% PASS |
| Lambda_Nf3 (MSbar) | 0.349 GeV | 0.332 GeV | 5.0% | <6% PASS |
| alpha_s(m_Z) | 0.1179 | 0.1179 | 0.0% | <1% PASS |
python3 nsqcd_cli.py --benchmark
Lock-free MPMC queue with batch operations
| Queue | Throughput (M items/s) | Latency (ns) | Speedup |
|---|---|---|---|
| NSQueue | 329.0 | 56.2 | 4.0x vs rigtorp |
| rigtorp::SPSCQueue | 81.4 | 352.6 | - |
g++ -O3 -march=native -std=c++17 queue_bench.cpp -o bench && ./bench
Distribution-aware sort with counting sort fast path
Dataset: n=100M elements, int64_t. 8/10 wins vs IPS4o. Losses on structureless data only.
| Distribution | NS (ms) | IPS4o (ms) | Speedup |
|---|---|---|---|
| Zeros | 0.001 | 182 | 182,000x |
| Sorted | 52.9 | 787 | 14.9x |
| Reverse sorted | 81.5 | 840 | 10.3x |
| Almost sorted | 712 | 782 | 1.10x |
| Root dup | 220 | 521 | 2.36x |
| Two dup | 126 | 186 | 1.47x |
| Eight dup | 135 | 243 | 1.80x |
| Zipf | 249 | 418 | 1.68x |
| Exponential | 2120 | 1107 | 1.91x Loss |
| Uniform | 1232 | 808 | 1.52x Loss |
g++ -O3 -march=native -fopenmp -std=c++17 NSSort.cpp bench_v10.cpp -o bench && ./bench
GPU-accelerated sort with two-level MSD radix
Dataset: n=100M elements, int64_t. 1570x on zero distribution vs cub::DeviceRadixSort (RTX 2000 Ada).
| Distribution | NS (ms) | cub::radix (ms) | Speedup |
|---|---|---|---|
| Zeros | 0.074 | 115.6 | 1570x |
| Sorted | 3.93 | 116.3 | 29.6x |
| Reverse sorted | 54.4 | 116.3 | 2.14x |
| Almost sorted | 60.5 | 116.3 | 1.92x |
| Root dup | 7.71 | 116.0 | 15.0x |
| Two dup | 8.85 | 115.6 | 13.1x |
| Eight dup | 7.52 | 115.6 | 15.4x |
| Zipf | 9.00 | 115.7 | 12.9x |
| Exponential | 117.6 | 116.4 | 1.01x Loss |
| Uniform | 180.4 | 117.9 | 1.53x Loss |
nvcc -O3 -arch=sm_70 -std=c++17 NSSort_GPU.cu -o bench && ./bench
String search index for amortized queries
| Scenario | NS (ms) | strstr (ms) | Speedup |
|---|---|---|---|
| 1000 queries | 63.44 | 136,613.44 | 2153.5x |
| 100 queries | 61.89 | 13,447.00 | 217.3x |
g++ -O3 -march=native -std=c++17 nsstringindex_bench.cpp -o bench && ./bench
Inference and quantization for transformer workloads
Sparse attention with fixed-window and variable-length sequence support
Fixed window size: 512
| seq_len | NSAttend (ms) | Dense (ms) | Speedup |
|---|---|---|---|
| 1024 | 10.12 | 56.65 | 5.6x |
| 2048 | 36.56 | 244.40 | 6.7x |
| 4096 | 64.58 | 829.75 | 12.9x |
| 8192 | 115.74 | 3320.31 | 28.7x |
g++ -O3 -march=native -std=c++17 nsattend.cpp -o bench && ./bench
CPU inference engine with energy-ordered neuron selection
| Method | Time (ms) | Speedup | Memory |
|---|---|---|---|
| Dense BLAS baseline | 160.2 | 1.0x | 0.086 GB |
| NSInfer (75% energy, K=0) | 52.7 | 3.04x | 0.041 GB |
3.04× MLP throughput · TinyLlama-1.1B · standalone
72B real-world: +70% prompt eval with --ns-infer on Qwen2.5-72B (A40)
Cosine similarity: 0.9693
g++ -O3 -march=native -std=c++17 nsinfer.cpp -o bench && ./bench
KV cache compression with cross-layer grouping and semantic deduplication
| Stage | Size (MiB) | Cumulative Compression |
|---|---|---|
| Raw KV (fp16) | 125,000 | 1.0x |
| Cross-layer grouping | 15,625 | 8.0x |
| INT4 quantization | 3,906 | 32.0x |
| Eviction (40% keep) | 1,563 | 80.0x |
| Filler elimination | 938 | 133.3x |
| Semantic dedup | 469 | 266.7x |
g++ -O3 -march=native -std=c++17 kv_box.cpp -o bench && ./bench
Variable-rate per-cluster quantization with repacking for GEMV inference
| Feature | Value |
|---|---|
| Formats supported | Q4_K, Q8_0, IQ2_XXS |
| Hot weights | Q8_0 (top 5% by activation) |
| Warm weights | Q4_K (next 25%) |
| Cold weights | IQ2_XXS (remaining 70%) |
| Disk reduction | 7.2× measured · 10-12× with delta compression (not yet implemented) |
Qwen2.5-3B · 6.18 GiB F16 → 1.61 GiB · 3.8× · coherent
Qwen2.5-72B · 140 GiB F16 → 19.4 GiB · 7.2× · coherent
Profiling: Wanda single-pass importance, 128 calibration samples. 72B profiles in ~6 minutes.
./nsquant <input.gguf> <output.nsm> [n_prompts [prompts.txt]]