Skip to content

Appendix A: RCRE Production Projects Hub

"An algorithm in isolation is mathematics; an algorithm integrated into a cache-coherent, zero-allocation pipeline is engineering."


A.1 The Bridge from Theory to Production

Throughout Chapters 1 through 16, this book systematically constructed the theoretical and algorithmic foundations of Recep's Code Runs Everywhere (RCRE): from branchless bitwise alignment and linear scratchpad arenas, to cache-blocked matrix multiplication, spatial stencils, and lock-free thread pools.

However, textbook algorithms only demonstrate their true power when combined into complete, cohesive production tools. Located in the projects/ directory of the main RCRE repository, you will find nine standalone, turnkey production systems.

Unlike minimal toy examples or Python wrapper scripts, every project here is: 1. 100% Pure ISO C23: Engineered with zero third-party dependencies (no OpenCV, no NumPy, no PyTorch, no libtorch). 2. Zero Runtime Heap Allocation: All memory is serviced by contiguous 64-byte aligned linear arenas (RCRE_Arena), guaranteeing zero memory leaks, zero fragmentation, and zero allocation jitter. 3. Hardware Vectorized: Optimized across ARM NEON, x86 AVX2/FMA, and WebAssembly SIMD128. 4. End-to-End Functional: Each project features self-contained CLI entry points, binary serializers, comprehensive automated verification suites, and interactive visual demos.

This appendix catalogues these production projects to inspire your own systems engineering journey.


A.2 Master Production Projects Matrix

Project Identifier Directory Core Mission & Architecture Textbook Foundation Chapters Verified Performance
rcre-lens projects/reverse_image_search/ High-speed reverse image search engine & visual database indexing using \(4 \times 4\) Spatial Pyramid color/texture moments. Ch 2, 3, 5, 10, 13 Sub-millisecond retrieval across large image galleries
rcre-facex projects/facial_expression_analysis/ Real-time face detection, 13-point anthropometric landmark localization, FACS Action Units, and 6-class emotion classification. Ch 2, 3, 5, 7, 14 400+ FPS throughput on 1080p video streams
rcre-mobilenet projects/cifar100_mobilenet/ MobileNet CNN forward inference with zero-cost edge BatchNorm folding and PyTorch training harness on CIFAR-100. Ch 2, 3, 4, 6, 11 3.24 ms forward pass (>300 FPS) on Apple Silicon CPU
rcre-pca projects/pca_compression/ Spatial PCA image compression codec with power-iteration deflation and 8-bit uniform scalar quantization. Ch 2, 4, 7, 15 \(8.8\times\) to \(25\times\) compression ratio with \(33.5\text{--}58.0\text{ dB}\) PSNR
rcre-perf projects/c_performance/ Systems microarchitecture, cache line locality, strided tensor view, and SIMD hardware execution profiling suite. Ch 1, 2, 3, 11, 12, 16 25.6x speedup; emits Chrome Tracing / Perfetto JSON telemetry
rcre-sr projects/document_super_resolution/ Document enhancement pipeline: separable Lanczos-3 bicubic upscaling, 2D FFT Wiener deconvolution, and adaptive thresholding. Ch 2, 3, 5, 6, 11 70+ MPix/sec restoration throughput
rcre-wavelet projects/wavelet_compression/ Reversible multi-resolution integer wavelet codec using LeGall 5/3 lifting and 2D DWT subband pyramids. Ch 2, 3, 5, 15 Lossless reconstruction down to \(32\times\) lossy quantization
rcre-xgb projects/rcre_xgb/ XGBoost-style regularized second-order gradient boosted decision trees with quantile histogram binning and NaN routing. Ch 2, 8, 9, 13 1.8 µs inference latency per sample evaluation
rcre-omnisearch projects/omnisearch_hash/ 30M multimodal vector search and locality-sensitive hashing (LSH) engine for mixed text and image embeddings. Ch 2, 10, 11, 13 Sub-50 µs approximate nearest neighbor lookup

A.3 Architectural Deep Dives

              ┌─────────────────────────────────────────────────────────┐
              │           RCRE PRODUCTION ARCHITECTURE STACK             │
              └────────────────────────────┬────────────────────────────┘
                                           │
         ┌─────────────────────────────────┴─────────────────────────────────┐
         ▼                                                                   ▼
┌───────────────────────────────┐                   ┌───────────────────────────────┐
│       Computer Vision         │                   │       Machine Learning        │
│  rcre-lens, rcre-facex,       │                   │  rcre-mobilenet, rcre-xgb,    │
│  rcre-pca, rcre-sr, wavelet   │                   │  rcre-omnisearch              │
└───────────────┬───────────────┘                   └───────────────┬───────────────┘
                │                                                   │
                └─────────────────────────┬─────────────────────────┘
                                          │
                                          ▼
                ┌───────────────────────────────────────────────────┐
                │             RCRE Core Foundation Stack             │
                │  - Contiguous Linear Arenas (Ch 2)                │
                │  - Zero-Copy ShapeTracker Strided Views (Ch 3)    │
                │  - Fused 25-Op Mathematical Kernel Graph (Ch 6)   │
                │  - Dynamic Hardware Abstraction Layer (HAL, Ch 12)│
                └─────────────────────────┬─────────────────────────┘
                                          │
        ┌─────────────────────────────────┴─────────────────────────────────┐
        ▼                                 ▼                                 ▼
[Apple Silicon NEON]             [x86-64 AVX2 / FMA]               [WebAssembly SIMD128]

1. rcre-lens: Reverse Visual Search Engine

  • How it Works: Given a directory of unlabeled images, rcre-lens decomposes each image into a \(4 \times 4\) spatial grid. In each cell, it calculates normalized RGB color moments and Sobel spatial gradient distributions, yielding a compact 64-dimensional descriptor.
  • Indexing & Retrieval: Descriptors are ingested into RCRE's Hierarchical Navigable Small World (HNSW) proximity graph (Chapter 10). Distance computations execute via fused SIMD dot products.
  • Key Code:
    # Index a directory of photos and launch interactive query demo:
    make project_lens_demo
    

2. rcre-facex: Real-Time Affective Biomechanics

  • How it Works: Implements a five-stage computer vision pipeline operating entirely in fixed scratchpad memory:
  • Skin Region Proposal: YCbCr chrominance thresholding combined with Summed Area Tables (SAT / Integral Images, Chapter 5) for \(\mathcal{O}(1)\) rectangle filtering.
  • Facial Landmark Localization: Sub-pixel dark-valley tracking locating 13 anthropometric keypoints (pupils, eyebrows, nose apex, mouth corners).
  • Facial Action Coding System (FACS): Computes scale-invariant geometric Action Units: AU12 (Smile Curvature), AU26/27 (Mouth Opening), AU1+AU2 (Brow Elevation), and AU4 (Glabella Wrinkle Energy).
  • Softmax Emotion Classifier: Evaluates categorical probabilities across 6 emotional states.
  • Key Code:
    # Execute the 9-invariant verification harness:
    make project_facex_test
    

3. rcre-mobilenet: Sub-4ms Deep Learning in Pure C23

  • How it Works: Demonstrates that high-accuracy neural networks do not require gigabytes of runtime dependencies. rcre-mobilenet implements forward inference for MobileNet v1 on CIFAR-100:
  • Depthwise Separable Convolutions: Factorizes standard \(3 \times 3\) convolutions into a \(3 \times 3\) depthwise filter followed by a \(1 \times 1\) pointwise projection (reducing FLOPs by \(8.5\times\)).
  • Zero-Cost Edge BatchNorm Folding: During compilation, BatchNorm \(\mu, \sigma, \gamma, \beta\) parameters are algebraically folded directly into the convolutional kernel weights: $\(W_{\text{folded}} = \frac{\gamma}{\sqrt{\sigma^2 + \epsilon}} \cdot W, \quad b_{\text{folded}} = \beta + \frac{\gamma}{\sqrt{\sigma^2 + \epsilon}} \cdot (b - \mu)\)$
  • Deterministic Memory Footprint: The entire inference pass executes within two alternating arena ping-pong scratchpads.
  • Key Code:
    # Run CIFAR-100 test sample inference:
    make project_mobilenet_demo
    

4. rcre-pca: Eigen-Compression & Interactive Web Studio

  • How it Works: Formulates image compression as low-rank approximation. Image patches (\(8 \times 8 = 64\text{-D}\)) are extracted zero-copy via ShapeTracker views (Chapter 3). The principal orthogonal eigenvectors are calculated using Power Iteration with Hotelling Deflation (Chapter 7).
  • Quantization & Storage: Projecting patches onto the top \(k\) principal components yields compact coordinate representations, stored using 8-bit uniform scalar quantization in the custom .rpca binary container.
  • Interactive Web Studio: Features an in-browser WebAssembly studio where users can test PCA compression live with their laptop webcam at web/playground.html.

5. rcre-xgb: High-Speed Gradient Boosted Decision Trees

  • How it Works: An industrial-strength implementation of Chen & Guestrin's second-order gradient boosting formulation (Chapter 9). Features exact greedy split-finding over quantile histograms, \(L_1/L_2\) leaf regularization, and missing-value NaN routing.
  • Silicon Efficiency: The trained tree ensemble is serialized into a flat, contiguous array of branchless node structures, eliminating pointer chasing and maximizing L1 instruction cache residency.

A.4 Launching Your Own Project: The project-template

To make it effortless for you to transition from studying the book to engineering your own standalone high-performance systems, RCRE includes a turnkey Starter Project Template located at:

apps/rcre/project-template/
├── include/
│   └── rcre.h          # Complete, self-contained single-header C23 RCRE engine
├── src/
│   └── main.c          # Starter application demonstrating arena & tensor math
├── tests/
│   └── test_main.c     # Unit verification harness under AddressSanitizer/UBSan
├── logs/
│   └── sample_run.log  # Reference execution telemetry log
├── Makefile            # Ready-to-use C23 build harness (all, run, test, clean)
├── README.md           # Onboarding guide: layout, memory rules, and deployment
└── GUIDELINES.md       # Developer mini guideline & silicon best practices cheat sheet

60-Second Onboarding Walkthrough

  1. Clone or Copy the Template:

    cp -r apps/rcre/project-template my_custom_engine
    cd my_custom_engine
    

  2. Compile and Run Immediately:

    make run
    

  3. Verify Under Memory Sanitizers:

    make test
    

By starting from project-template/, you inherit RCRE's zero-heap memory philosophy, branchless C23 math primitives, and automated sanitizer harness out of the box—freeing you to focus 100% of your energy on your algorithm.


A.5 Summary: The C23 Systems Engineer's Manifesto

  1. Own Your Memory: Never invoke malloc() in an execution loop. Pre-allocate contiguous arenas and rewind offsets with \(\mathcal{O}(1)\) pointer arithmetic.
  2. Respect the Silicon: Align data to 64-byte cache boundaries, access multidimensional tensors in row-major strides, and saturate SIMD execution units.
  3. Keep Code Zero-Dependency: Building from first principles guarantees that your application will compile and execute with identical deterministic speed on a micro-drone microcontroller, a high-end workstation, an HPC supercomputing cluster, or inside a web browser.