<?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: Sihwan Lee</title>
    <description>The latest articles on DEV Community by Sihwan Lee (@leeshiny7).</description>
    <link>https://dev.to/leeshiny7</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%2F4232760%2F2c1ad450-3fd7-4406-9574-c3b78a9f8232.png</url>
      <title>DEV Community: Sihwan Lee</title>
      <link>https://dev.to/leeshiny7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/leeshiny7"/>
    <language>en</language>
    <item>
      <title>I rewrote 7-Zip in Rust — here's what I learned about memory</title>
      <dc:creator>Sihwan Lee</dc:creator>
      <pubDate>Sat, 07 Nov 2026 20:23:59 +0000</pubDate>
      <link>https://dev.to/leeshiny7/i-rewrote-7-zip-in-rust-heres-what-i-learned-about-memory-2nj7</link>
      <guid>https://dev.to/leeshiny7/i-rewrote-7-zip-in-rust-heres-what-i-learned-about-memory-2nj7</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq6f8kchhwo0txf4dlaqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq6f8kchhwo0txf4dlaqc.png" alt=" " width="799" height="537"&gt;&lt;/a&gt;&lt;br&gt;
7-Zip is legendary for compression ratio and speed. It's also legendary for&lt;br&gt;
eating RAM: compressing a 500 MB log file at 16 threads peaks at ~1.8 GB.&lt;/p&gt;

&lt;p&gt;I wondered: how much of that is the algorithm, and how much is the&lt;br&gt;
implementation? So I wrote &lt;code&gt;r7z&lt;/code&gt;, a Rust clone of the core &lt;code&gt;a&lt;/code&gt;/&lt;code&gt;x&lt;/code&gt; commands,&lt;br&gt;
and measured.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers
&lt;/h2&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;r7z&lt;/th&gt;
&lt;th&gt;7z&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Time (500 MB text, 1 thread)&lt;/td&gt;
&lt;td&gt;68.4 s&lt;/td&gt;
&lt;td&gt;19.4 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Peak RSS (same)&lt;/td&gt;
&lt;td&gt;85 MB&lt;/td&gt;
&lt;td&gt;376 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Peak RSS (16 threads)&lt;/td&gt;
&lt;td&gt;85 MB&lt;/td&gt;
&lt;td&gt;1.8 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ratio&lt;/td&gt;
&lt;td&gt;0.02%&lt;/td&gt;
&lt;td&gt;0.02%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ratios are essentially identical&lt;/strong&gt; — the algorithm dominates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory is an implementation choice.&lt;/strong&gt; 7z's solid-block arenas and per-thread
buffers scale with thread count. r7z's bounded buffers don't.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Speed is where C++ still wins&lt;/strong&gt; — SIMD range coder, tuned match finder,
and a custom work-stealing pool. Pure Rust can't match that yet without
&lt;code&gt;target-cpu=native&lt;/code&gt;, SIMD intrinsics, or FFI to liblzma.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;FFI path via &lt;code&gt;xz2&lt;/code&gt; for parity speed&lt;/li&gt;
&lt;li&gt;SIMD CRC-32 / match finder&lt;/li&gt;
&lt;li&gt;Real multi-threading (currently single-threaded encoder)&lt;/li&gt;
&lt;li&gt;Solid-block size knob&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/WhAnci/r7z" rel="noopener noreferrer"&gt;https://github.com/WhAnci/r7z&lt;/a&gt; (English/Korean/Chinese README)&lt;/p&gt;

</description>
      <category>rust</category>
      <category>performance</category>
      <category>compression</category>
      <category>cli</category>
    </item>
  </channel>
</rss>
