Skip to content

Conversation

@Krishna200608
Copy link
Contributor

Issue: #72

FIX: Implemented object compression using zlib (Deflate) in src/data.py.

Rationale & Trade-offs

I selected zlib after evaluating lzma, bz2, and zstd against the project's requirements.

  1. Constraint Compliance (No External Dependencies):

    • zstd: While zstd is often cited as a superior algorithm, it requires the zstandard package (not in the Python Standard Library until 3.14+). This violates the project's "External Dependencies: NONE" rule stated in README.md.
    • zlib: Is part of the Python Standard Library, ensuring the project remains dependency-free.
  2. Performance (Speed vs Size):

    • lzma: Offers higher compression ratios but is significantly slower (high CPU cost). For a VCS that commits hundreds of files, this latency is unacceptable for the "hot path."
    • zlib: The industry standard for Git-like systems. It offers an excellent balance of speed and storage efficiency.

Benchmark Results

Tested using the provided file diff.c (Vim source code).

Metric Value
Original Size ~126 KB (129,580 bytes)
Compressed Size (zlib) ~35 KB (35,824 bytes)
Space Savings ~72% Reduction
Compression Ratio 3.6 : 1

Conclusion: zlib provides significant storage savings (shrinking the file to nearly 1/4th its size) while maintaining the low latency required for a responsive CLI.

@OpenGitBot
Copy link

Hey @Krishna200608

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
Copy link
Contributor

Thank you for the research and foresight :D

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

Hey @Krishna200608

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

Thanks for contributing in OpenCode'25✨✨

@Krishna200608 Krishna200608 deleted the feat-zlib-compression branch January 3, 2026 10:15
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