hasssanezzz / huffman-coding

Huffman-Coding implemented in 5 different programming languages.
11 stars 1 forks source link

Proposal: Efficiency and Usability Improvements for Huffman Coding Implementation #1

Open Ebrahim-Ramadan opened 3 months ago

Ebrahim-Ramadan commented 3 months ago

In python implementation: I tried compressing some 491KB file and it resulted as: Original file size: 491 compressed file size: 732 Compression ratio: -49.083503054989805

So I've made some improvements to the Huffman coding implementation that I believe could benefit this ( forked here ). The main changes include:

  1. Bit-level encoding and decoding for improved memory efficiency and performance
  2. Enhanced type hinting for better code clarity
  3. Optimized file handling using with statements
  4. Added minimum file size check (100 bytes) to avoid unnecessary compression
  5. Refactored encode_file() and decode_file() methods
  6. Improved user experience with clearer usage instructions
  7. Added compression effectiveness reporting

These changes aim to:

hasssanezzz commented 3 months ago

Good work, can you please create a PR?