Skip to content

Header-only C++20 utility library — AI-authored, zero dependencies

License

Notifications You must be signed in to change notification settings

schroedermatthew/FatP

Repository files navigation

FAT-P

A header-only C++20 utility library. Zero external dependencies.

⚠️ Work in progress — APIs are not yet stable.

FatP CI Header Hygiene FATP_META Compliance Layer & Dependency Verification

All CI Workflows

Core Infrastructure

FatP CI FatPTest CI FatPBenchmarkRunner CI FatPConcepts CI

Verification

Layer & Dependency Verification FATP_META Compliance Header Hygiene

Components

AlignedVector CI AllocationStrategies CI BinaryLite CI BitSet CI CacheUtilities CI CborLite CI CborStreamLite CI CheckedArithmetic CI CircularBuffer CI Concepts CI ConcurrencyPolicies CI ConstexprUtilities CI ContractException CI CoroutineTask CI CSRMatrix CI CSRMatrixParallel CI CSRMatrix_HPC CI CSRMatrix_HPC_Parallel CI DebugOnly CI DiagnosticLogger_Core CI DiagnosticLogger_IO CI DiagnosticLogger_Json CI DiagnosticLogger_ScopeGuard CI Enforce CI EnforcedInit CI EnhancedBoundsChecking CI EnumPlus CI EqualityAny CI EqualityComparisons CI Expected CI Factory CI FatPBinary CI FatPCbor CI FatPCborStream CI FatPHashMap CI FatPJson CI FatPJsonStream CI FeatureManager CI FlatMap CI FlatSet CI FloatingPointComparison CI HpcVector CI IdGenerator CI IntrusiveList CI JsonLite CI JsonStreamLite CI LockFreeQueue CI LockFreeRingBuffer CI MemoryMappedFile CI NumaAllocator CI ObjectPool CI PolicyIterator CI RateLimiter CI RcuIntegration CI Reflection CI ScopeGuard CI ScopeGuardExpected CI ServiceLocator CI Signal CI SimdVector CI SlidingFileWindow CI SlotMap CI SmallVector CI SparseSet CI Stacktrace CI StateMachine CI StringPool CI Stringify CI StrongId CI Tensor CI TensorComparison CI TensorEinsum CI TensorMath CI TensorSerializer CI TensorStorage CI ThreadPool CI ValueGuard CI ViewLifetimeTracking CI WorkQueue CI

Benchmarks

AlignedVector Benchmarks AllocationStrategies Benchmarks BitSet Benchmarks Build Benchmark Deps CircularBuffer Benchmarks FatPHashMap Benchmarks FlatMapSet Benchmarks IntrusiveList Benchmarks LockFreeQueue Benchmarks ObjectPool Benchmarks PolicyIterator Benchmarks ServiceLocator Benchmarks SlotMap Benchmarks SmallVector Benchmarks SparseSet Benchmarks StateMachine Benchmarks StrongId Benchmarks ThreadPool Benchmarks WorkQueue Benchmarks

Aggregate Runners

Run All Run All Benchmarks (Clang) Run All Benchmarks (GCC) Run All Benchmarks (MSVC)


Overview

FAT-P provides containers, concurrency primitives, memory management utilities, serialization, and diagnostic tools as a self-contained, header-only library. Copy include/fat_p/ into your project and go — no build system integration required.

How This Library Was Built

All code, architecture, documentation, and governance in this library were authored by AI systems — primarily Claude (Anthropic), with contributions from ChatGPT, Gemini, and Grok. The human (Matthew Schroeder) provided direction, constraints, and judgment but wrote none of the code.

The library was developed using a multi-AI collaborative pipeline: independent parallel design, cross-review and synthesis, adversarial review, and context reset cycles. The complete methodology is documented in Fat-P AI-Collaborative Development Methodology.

23 components have been benchmarked against 50+ competitor implementations from Boost, Abseil, LLVM, EASTL, and others. Most are competitive; some lead on specific operations, some trail. The data — including where FAT-P loses — is in benchmark_results/.

What this library is not. FAT-P has no installed base, no production deployments, and no history of use under real-world workloads. The benchmarks demonstrate competitive performance in controlled measurement; they do not demonstrate the edge-case resilience that comes from years of bug reports, platform quirks, and adversarial inputs. Libraries like Boost and Abseil have earned trust through decades of deployment across millions of systems. FAT-P has earned nothing yet except clean benchmarks and green CI. Use it with that understanding.

For the full account of who did what, see Authors.md.

Requirements

  • C++20 (GCC 10+, Clang 12+, MSVC 19.29+)
  • No external dependencies

Installation

cp -r include/fat_p /your/project/include/

Or with CMake:

add_subdirectory(path/to/FatP)
target_link_libraries(your_target PRIVATE fatp)

Components

Containers

Component Description
SmallVector Inline-storage vector, zero heap allocation for small sizes
FlatMap / FlatSet Sorted vector-backed associative containers
FastHashMap High-performance open-addressing hash map
StableHashMap Hash map with pointer/reference stability on insert
CircularBuffer Fixed-capacity ring buffer with O(1) push/pop
IntrusiveList Intrusive doubly-linked list, zero allocation overhead
SlotMap Generational index container with stable handles
SparseSet Sparse set with dense iteration
BitSet Fixed-size bit set with compiler intrinsics

Memory and Allocation

Component Description
ObjectPool Object pool with concurrency policy support
AllocationStrategies Lightweight allocator policies
NumaAllocator NUMA-aware memory allocator
StringPool String interning with policy-based thread safety
AlignedVector Cache-aligned vector for HPC workloads
HpcVector NUMA-local, SIMD-ready vector

Concurrency

Component Description
ThreadPool Work-stealing thread pool with priority queues
WorkQueue Sharded lock-free MPMC work queue
LockFreeQueue Lock-free MPMC queue with ABA prevention
LockFreeRingBuffer Lock-free ring buffers (SPSC and MPMC)
ConcurrencyPolicies Thread-safety policy classes for containers
RateLimiter Token bucket and sliding window rate limiters
Signal Signal/slot implementation

Error Handling and Contracts

Component Description
Expected Monadic error handling (value-or-error type)
Enforce Design-by-contract macros with customizable predicates
ScopeGuard RAII scope-exit cleanup
ContractException Exception classes for contract violations
CheckedArithmetic Overflow-safe arithmetic for integers and floats
EnforcedInit Wrapper enforcing explicit initialization

Serialization

Component Description
JSON / JsonLite JSON serialization with lite and streaming variants
CBOR / CborLite CBOR serialization with lite and streaming variants
Binary Binary serialization format

Math and HPC

Component Description
Tensor N-dimensional tensor with math, einsum, and serialization
CSRMatrix Compressed Sparse Row matrix with parallel/HPC variants
SimdVector Universal SIMD wrapper for vectorized operations
FloatingPointComparison ULP, relative, and absolute float comparison

Diagnostics and Utilities

Component Description
DiagnosticLogger Structured logging with JSON output and scope tracking
Stacktrace Portable stack trace capture
Reflection Compile-time reflection with unified macro syntax
StateMachine Type-safe FSM with compile-time transition validation
EnumPlus Enhanced enums with string conversion and iteration
StrongId Type-safe ID wrapper preventing cross-domain mixing
FeatureManager Runtime feature flags with compile-time optimization
ServiceLocator Policy-based service locator with scoped overrides
IdGenerator Type-safe unique ID generation with recycling
Stringify Type-to-string conversion using C++20 concepts
DebugOnly Debug-only utilities that compile away in release
ConstexprUtilities Compile-time utility functions
Concepts C++20 concepts for type constraints
PlatformDetection Compiler, OS, and architecture detection
CacheUtilities Cache control and prefetching utilities
ValueGuard Temporary value modification with automatic restoration
ViewLifetimeTracking Debug-only lifetime tracking for views and references
MemoryMappedFile Cross-platform memory-mapped file I/O
SlidingFileWindow Sliding window access to large files
CoroutineTask C++20 coroutine support with Expected integration
AsyncOperations Async operation utilities
Factory Policy-based factory with compile-time customization

Testing and Benchmarking

Component Description
FatPTest Zero-dependency test framework
FatPBenchmarkRunner Zero-dependency benchmark infrastructure

Project Structure

FatP/
├── include/fat_p/       # Library headers
├── components/          # Per-component tests, benchmarks, and docs
├── Teaching/            # Guides, case studies, and reference material
├── Read_Me/             # Development guidelines and style guides
└── .github/workflows/   # CI workflows

Building Tests

cmake -B build -DFATP_BUILD_TESTS=ON -DFATP_BUILD_BENCHMARKS=OFF
cmake --build build
ctest --test-dir build

License

MIT — see LICENSE.