Skip to content

Conversation

@Aaryan-Degama
Copy link
Contributor

@Aaryan-Degama Aaryan-Degama commented Dec 31, 2025

Issue : #72

pics for reff :
image
image
image
image

I propose implementing zlib (level = 6) as default for our VCS. As it gives the most balanced performance

Performance Analysis ( on diff.c )
Raw size: 129,580 bytes
Comparing (these are compared to zlib level = 6)

  1. bz2 is too slow both for compression and decompression even though it provided a slightly better size compression
  2. same with lzma
  3. gzip is also too slow and the compression is similar
  4. gzip and zlib (level =9 ) have similar stats

Internal Mechanics: Why it Works
The chosen algorithm uses the DEFLATE method, combining two powerful techniques that allow it to handle both structured text and binary data effectively.

  1. LZ77 (Dictionary Matching)
    Process: The algorithm scans for repeated patterns. Instead of rewriting a sequence like for(int i=0; i < n; i++), it stores a "match" pointer (distance and length) to the previous occurrence.

Binary Benefit: Efficiently finds repeating color blocks in images or repeating structures in binary data.

  1. Huffman Coding (Statistical Compression) (DSA me padha tha google wali bashi neeche 👇)
    Process: After pattern matching, it maps characters/sequences to variable-length bit-strings based on frequency. High-frequency data gets a very short code (e.g., 2 bits), while rare data gets a longer one.

Why it helps: This shrinks the file at a bitwise level, ensuring compression even when no obvious text patterns exist.

@OpenGitBot
Copy link

Hey @Aaryan-Degama

Thanks for opening this PR 🚀. Mentor will review your pull request soon and till then, keep contributing and stay calm.

Thanks for contributing in OpenCode'25 ✨✨!

@Rational-Idiot Rational-Idiot merged commit 7f352d4 into opencodeiiita:main Jan 3, 2026
@OpenGitBot
Copy link

Hey @Aaryan-Degama

Your PR has been merged 🥳🥳 and you have earned 40 points.

Thanks for contributing in OpenCode'25✨✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants