main shows compression ratios again
README also updated to show compression ratios.
This commit is contained in:
parent
3d1deaacc1
commit
37e28f8c0e
2 changed files with 8 additions and 5 deletions
|
|
@ -1,5 +1,7 @@
|
|||
Compresses files using [Huffman coding](https://en.wikipedia.org/wiki/Huffman_coding). Please note that decompression isn't fully implemented yet. It is however implemented to the point where we know compression works correctly.
|
||||
|
||||
On [The Great Gatsby in plain text](https://www.gutenberg.org/cache/epub/64317/pg64317.txt) on project Gutenberg, it achieves a 0.526 compression ratio when using a word size of two bytes. On an arbitrary RAW image, it peaks at .622 with a 32 bit word size and .645 with a 16 bit one.
|
||||
|
||||
To run with [Nix](nixos.org):
|
||||
``` sh
|
||||
nix run ".#" --experimental-features "nix-command flakes" -- myFile
|
||||
|
|
|
|||
11
src/Main.hs
11
src/Main.hs
|
|
@ -140,9 +140,10 @@ main :: IO ()
|
|||
main = do
|
||||
[filePath] <- SE.getArgs
|
||||
f <- BS.readFile filePath
|
||||
-- TIO.putStrLn "compression ratios:"
|
||||
TIO.putStrLn "does decompress . compress == id ?"
|
||||
print . ("Word64",) . testCompression (D.Proxy :: D.Proxy Word16) $ f
|
||||
-- print . ("Word64",) . compressionRatioFor (D.Proxy :: D.Proxy Word64) $ f
|
||||
-- print . ("Word32",) . compressionRatioFor (D.Proxy :: D.Proxy Word32) $ f
|
||||
-- print . ("Word16",) . compressionRatioFor (D.Proxy :: D.Proxy Word16) $ f
|
||||
-- print . ("Word8",) . compressionRatioFor (D.Proxy :: D.Proxy Word8) $ f
|
||||
TIO.putStrLn "compression ratios:"
|
||||
print . ("Word64",) . compressionRatioFor (D.Proxy :: D.Proxy Word64) $ f
|
||||
print . ("Word32",) . compressionRatioFor (D.Proxy :: D.Proxy Word32) $ f
|
||||
print . ("Word16",) . compressionRatioFor (D.Proxy :: D.Proxy Word16) $ f
|
||||
print . ("Word8",) . compressionRatioFor (D.Proxy :: D.Proxy Word8) $ f
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue