My working unpac space for OCaml projects in development
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add STATUS.md with consistent project status format

Status: FUNCTIONAL - Pure OCaml Snappy compression.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+53
+53
STATUS.md
··· 1 + # snappy 2 + 3 + **Status: FUNCTIONAL** 4 + 5 + ## Overview 6 + A pure OCaml implementation of Google's Snappy compression format. This is not C bindings - it is a complete reimplementation of the Snappy algorithm in OCaml, designed for minimal memory allocation during compression and decompression. 7 + 8 + ## Current State 9 + The implementation is feature-complete with both compression and decompression working: 10 + 11 + - **Compression**: LZ77-style compression with hash table for match finding 12 + - **Decompression**: Full support for all Snappy tag types (literals, 1/2/4-byte offset copies) 13 + - **Varint encoding/decoding**: For length headers 14 + - **Overlap handling**: Proper byte-by-byte copy for RLE-style patterns 15 + - **Low-allocation API**: `compress_into`/`decompress_into` for writing to pre-allocated buffers 16 + - **Error handling**: Typed errors and exception variants 17 + 18 + Performance optimizations included: 19 + - Unsafe byte access in verified hot paths (`Bytes.unsafe_get`/`unsafe_set`) 20 + - OCaml compiler optimization flags (`-O3 -unbox-closures`) 21 + - Hash table-based match finding with 32KB window 22 + 23 + ## Dependencies 24 + - ocaml (>= 4.14.0) 25 + - dune (>= 3.0) 26 + - alcotest (test only, >= 1.7.0) 27 + 28 + ## TODO 29 + - [ ] Streaming API for processing large data without full buffering 30 + - [ ] Framing format support (Snappy framing for arbitrary-length streams) 31 + - [ ] Benchmarks comparing to C snappy bindings 32 + - [ ] Update placeholder author/maintainer info in dune-project 33 + 34 + ## Build & Test 35 + ```bash 36 + # Build 37 + dune build 38 + 39 + # Run tests 40 + dune test 41 + 42 + # Run only quick tests 43 + dune test --force 44 + 45 + # Install 46 + dune install 47 + ``` 48 + 49 + ## Notes 50 + - Tests pass against standard Snappy test corpus (alice29.txt, html, urls, etc.) 51 + - Handles bad/malformed compressed data gracefully with proper error messages 52 + - Maximum copy offset is 32KB (standard Snappy limitation) 53 + - Compression ratio on repeated patterns is excellent (<10% for highly repetitive data)