Skip to content

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 AsyncOperations 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_HPC_Parallel CI CSRMatrix_HPC CI CSRMatrixParallel CI CSRMatrix CI DebugOnly CI DiagnosticContext 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 FatPCborStream CI FatPCbor CI FatPHashMap CI FatPJsonStream CI FatPJson CI FeatureManager CI FlatMap CI FlatSet CI FloatingPointComparison CI HPCVector CI IdGenerator CI IntrusiveList CI Jet CI JsonLite CI JsonStreamLite CI LockFreeQueue CI LockFreeRingBuffer CI MemoryMappedFile CI NUMAAllocator CI ObjectPool CI PolicyIterator CI RateLimiter CI RCUIntegration CI Reflection CI ScopeGuardExpected CI ScopeGuard CI ServiceLocator CI Signal CI SIMDVector CI Skeleton CI SlidingFileWindow CI SlotMap CI SmallVector CI SparseSet CI Stacktrace CI StateMachine CI StringPool CI Stringify CI StrongId CI TensorComparison CI TensorEinsum CI TensorMath CI TensorSerializer CI TensorStorage CI Tensor CI ThreadPool CI ValueGuard CI ViewLifetimeTracking CI WorkQueue CI XmlLite CI

Benchmarks

AlignedVector Benchmarks AllocationStrategies Benchmarks BitSet Benchmarks Build Benchmark Deps CircularBuffer Benchmarks FatPHashMap Benchmarks FeatureManager Benchmarks FlatMapSet Benchmarks IntrusiveList Benchmarks LockFreeQueue Benchmarks ObjectPool Benchmarks PolicyIterator Benchmarks Run All Benchmarks (All Compilers) ServiceLocator Benchmarks Skeleton Benchmarks SlotMap Benchmarks SmallVector Benchmarks SparseSet Benchmarks StateMachine Benchmarks StringPool Benchmarks StrongId Benchmarks ThreadPool Benchmarks WorkQueue Benchmarks

Aggregate Runners

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


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.

24 components have benchmark suites 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

Per-component tests, benchmarks, and user manuals live under components/. Highlights by area:

Containers

Component Description
SmallVector Inline-storage vector, zero heap allocation for small sizes
FlatMap / FlatSet Sorted vector-backed associative containers
FastHashMap (FatPHashMap) High-performance open-addressing hash map with policy variants
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
PolicyIterator Policy-based iterator utilities for container traversal

Memory and Allocation

Component Description
ObjectPool Object pool with concurrency policy support
AllocationStrategies Lightweight allocator policies
NumaAllocator NUMA-aware memory allocator (Linux CI)
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
DiagnosticContext Thread-local context stack for richer contract failures
ScopeGuard / ScopeGuardExpected RAII scope-exit cleanup (throwing and Expected-based)
ContractException Exception classes for contract violations
CheckedArithmetic Overflow-safe arithmetic for integers and floats
EnforcedInit Wrapper enforcing explicit initialization
EnhancedBoundsChecking Bounds-checking helpers beyond raw indexing

Serialization

Component Description
JsonLite / JsonStreamLite Standalone JSON (variant model, struct macros, ADL dispatch)
FatPJson / FatPJsonStream Expected-based JSON bridge over JsonLite
XmlLite Standalone XML parser/serializer with struct macros and vector modes
CborLite / CborStreamLite Low-level CBOR encoder/decoder and streaming parser
FatPCbor / FatPCborStream Expected-based CBOR bridge
BinaryLite / FatPBinary Binary serialization (lite and Fat-P integrated)
TensorSerializer Tensor snapshot encoding/decoding

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
Jet Fixed-size forward-mode automatic differentiation scalar

Domain

Component Description
Skeleton Typed hierarchical item registry (Bone addresses, capability masks)
StateMachine Type-safe FSM with compile-time transition validation

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
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
EqualityAny / EqualityComparisons Type-erased and typed equality helpers
DebugOnly Debug-only utilities that compile away in release
ConstexprUtilities Compile-time utility functions
Concepts / FatPConcepts C++20 concepts for type constraints
PlatformDetection / CppFeatureDetection Compiler, OS, architecture, and feature 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 (Linux CI)
SlidingFileWindow Sliding window access to large files (Linux CI)
CoroutineTask / AsyncOperations C++20 coroutine and async utilities with Expected integration
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
├── ThirdParty/          # Vendored headers used by tests and benchmarks
├── benchmark_results/   # Published competitive benchmark analysis
├── Teaching/            # Guides, case studies, and reference material
├── Read_Me/             # Development guidelines and style guides
├── tools/               # Build scripts, CI generators, Desktop sync (see tools/README.md)
└── .github/workflows/   # CI workflows (regenerate with tools/generate_workflows.py)

Building Tests

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

Maintainer tools

Build helpers, CI generators, and the commit → push → sync Desktop workflow live under tools/. Regenerate README CI badges with python tools/update_readme_badges.py after adding workflows. See tools/README.md for full documentation.

License

MIT — see LICENSE.

About

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

Topics

Resources

License

Contributing

Stars

5 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors