<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kanatore IT</title>
    <description>The latest articles on DEV Community by Kanatore IT (@kanatoreit).</description>
    <link>https://dev.to/kanatoreit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4273179%2F13e853c5-7f7c-4285-bca8-7ecafa186a2e.png</url>
      <title>DEV Community: Kanatore IT</title>
      <link>https://dev.to/kanatoreit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kanatoreit"/>
    <language>en</language>
    <item>
      <title>Building SOVDEFLATE: A Zero-Dependency C11 DEFLATE/ZLIB/GZIP Engine with AVX2 &amp; AVX-512 VNNI</title>
      <dc:creator>Kanatore IT</dc:creator>
      <pubDate>Mon, 30 Nov 2026 01:47:35 +0000</pubDate>
      <link>https://dev.to/kanatoreit/building-sovdeflate-a-zero-dependency-c11-deflatezlibgzip-engine-with-avx2-avx-512-vnni-4p01</link>
      <guid>https://dev.to/kanatoreit/building-sovdeflate-a-zero-dependency-c11-deflatezlibgzip-engine-with-avx2-avx-512-vnni-4p01</guid>
      <description>&lt;p&gt;When working with real-world document pipelines—especially PDFs—standard compression libraries often run into subtle edge cases: trailing bytes after a stream (like &lt;code&gt;\nendstream&lt;/code&gt;), partially corrupted streams that still need partial recovery, or strict zero-dependency requirements in C11 environments.&lt;/p&gt;

&lt;p&gt;To solve this, I built &lt;strong&gt;SOVDEFLATE&lt;/strong&gt; (&lt;code&gt;v3.0.0&lt;/code&gt;), an in-house DEFLATE (RFC 1951), ZLIB (RFC 1950), and GZIP (RFC 1952) engine written entirely from scratch in C11 with zero third-party code: &lt;a href="https://github.com/KanatoreIT/SOVDEFLATE" rel="noopener noreferrer"&gt;https://github.com/KanatoreIT/SOVDEFLATE&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Architecture &amp;amp; Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero Dependencies:&lt;/strong&gt; Uses only the C11 standard library and native OS threading APIs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime SIMD Dispatch:&lt;/strong&gt; Automatically selects between scalar baseline, BMI2, AVX2, and 256-bit AVX-512 VL + VNNI (used for Adler-32 checksums) at startup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clean PDF Stream Prefix Decoding:&lt;/strong&gt; Includes &lt;code&gt;sovdeflate_decompress_prefix&lt;/code&gt; and a streaming decoder that stops at the exact end of a DEFLATE stream without consuming or rejecting trailing delimiters, returning the exact byte count consumed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Corrupted Stream Recovery:&lt;/strong&gt; Recovers partial data from damaged streams matching &lt;code&gt;zlib&lt;/code&gt; behavior (validated against 11,982 damaged streams).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optional C++20 Header-Only Wrapper:&lt;/strong&gt; &lt;code&gt;sovdeflate_cpp20.hpp&lt;/code&gt; for modern C++ codebases, plus custom memory allocators with byte limits.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Real-World Benchmarks
&lt;/h2&gt;

&lt;p&gt;Tested across &lt;strong&gt;2,000 real DocLayNet PDFs&lt;/strong&gt; (22,647 streams, 445.5 MB uncompressed) on an Intel Core i5-11400H:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;SOVDEFLATE 3.0.0&lt;/th&gt;
&lt;th&gt;libdeflate 1.26&lt;/th&gt;
&lt;th&gt;zlib 1.3.2&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Decompression (1 thread)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;713 MB/s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;738 MB/s&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Decompression (12 threads)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;5,310 MB/s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;6,037 MB/s&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Compression (DEFAULT / level 6)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;77.7 MB/s&lt;/strong&gt; (1.000×)&lt;/td&gt;
&lt;td&gt;127.2 MB/s&lt;/td&gt;
&lt;td&gt;46.8 MB/s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Single-threaded decompression is within ~3.5% of &lt;code&gt;libdeflate&lt;/code&gt;, and default compression already outpaces &lt;code&gt;zlib&lt;/code&gt; at identical output size (closing the remaining compression speed gap against &lt;code&gt;libdeflate&lt;/code&gt; is the main focus for the next release).&lt;/p&gt;

&lt;h2&gt;
  
  
  Verification &amp;amp; Originality
&lt;/h2&gt;

&lt;p&gt;The repository includes ASan/UBSan test suites and a cross-check originality audit script (&lt;code&gt;tools/verificacion/auditoria/similitud.py&lt;/code&gt;) comparing the codebase against &lt;code&gt;zlib&lt;/code&gt;, &lt;code&gt;zlib-ng&lt;/code&gt;, &lt;code&gt;libdeflate&lt;/code&gt;, &lt;code&gt;miniz&lt;/code&gt;, and &lt;code&gt;stb&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Source Code &amp;amp; Releases:&lt;/strong&gt; &lt;a href="https://github.com/KanatoreIT/SOVDEFLATE" rel="noopener noreferrer"&gt;https://github.com/KanatoreIT/SOVDEFLATE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Profile &amp;amp; More C/C++ Engines:&lt;/strong&gt; &lt;a href="https://github.com/KanatoreIT/SOVDEFLATE" rel="noopener noreferrer"&gt;https://github.com/KanatoreIT/SOVDEFLATE&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feedback, benchmarks on other CPU architectures, and PRs are welcome!&lt;/p&gt;

</description>
      <category>performance</category>
      <category>opensource</category>
      <category>programming</category>
      <category>c</category>
    </item>
  </channel>
</rss>
