lzlib 1.0.1.0 → 1.0.2.1
raw patch · 4 files changed
+56/−33 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Codec.Lzip: compressSz :: ByteString -> Int -> ByteString
+ Codec.Lzip: compressSzBest :: ByteString -> Int -> ByteString
+ Codec.Lzip: compressSzFast :: ByteString -> Int -> ByteString
Files
- CHANGELOG.md +8/−0
- bench/Bench.hs +13/−27
- lzlib.cabal +1/−1
- src/Codec/Lzip.hs +34/−5
CHANGELOG.md view
@@ -1,5 +1,13 @@ # lzlib +## 1.0.2.1++ * Tweak buffering++## 1.0.2.0++ * Improve haddocks+ ## 1.0.1.0 * Export `lZApiVersion` and `lZVersion`
bench/Bench.hs view
@@ -6,36 +6,22 @@ import System.FilePath ((</>)) import System.IO.Temp (withSystemTempDirectory) -roundtrip :: BSL.ByteString -> BSL.ByteString-roundtrip = compress . decompress--roundtrip' :: BSL.ByteString -> BSL.ByteString-roundtrip' = decompress . compress--unpack :: IO ()-unpack = withSystemTempDirectory "lzlib" $- \fp -> BSL.writeFile (fp </> "lzlib.tar.lz") =<<- (roundtrip <$> BSL.readFile "lzlib-1.10.tar.lz")+unpack :: FilePath -> IO ()+unpack fp' = withSystemTempDirectory "lzlib" $+ \fp -> BSL.writeFile (fp </> "dump.tar") =<<+ (decompress <$> BSL.readFile fp') -unpack' :: IO ()-unpack' = withSystemTempDirectory "lzlib" $- \fp -> BSL.writeFile (fp </> "lzlib.tar") =<<- (roundtrip' <$> BSL.readFile "lzlib-1.10.tar")+pack :: FilePath -> IO ()+pack fp' = withSystemTempDirectory "lzlib" $+ \fp -> BSL.writeFile (fp </> "dump.tar.lz") =<<+ (compressFile fp') main :: IO () main =- defaultMain [ env file $ \ f ->- bgroup "roundtrip (decompress/compress)"- [ bench "lzlib (lzlib)" $ nf roundtrip f- ]- , bgroup "unpack (decompress/compress)"- [ bench "lzlib" $ nfIO unpack ]- , env decompressed $ \ f ->- bgroup "roundtrip' (compress/decompress)"- [ bench "lzlib (lzlib)" $ nf roundtrip' f+ defaultMain [ bgroup "unpack"+ [ bench "lzlib" $ nfIO (unpack "lzlib-1.10.tar.lz")+ , bench "lzlib" $ nfIO (unpack "gmp-6.1.2.tar.lz") ]- , bgroup "unpack' (compress/decompress)"- [ bench "lzlib" $ nfIO unpack' ]+ , bgroup "pack"+ [ bench "lzlib" $ nfIO (pack "lzlib-1.10.tar") ] ]- where file = BSL.readFile "lzlib-1.10.tar.lz"- decompressed = BSL.readFile "lzlib-1.10.tar"
lzlib.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: lzlib-version: 1.0.1.0+version: 1.0.2.1 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2019-2020 Vanessa McHale
src/Codec/Lzip.hs view
@@ -1,13 +1,18 @@ {-# LANGUAGE TupleSections #-} -module Codec.Lzip ( compress+module Codec.Lzip ( -- * Compression+ compress , compressBest , compressFast+ , compressSz+ , compressSzBest+ , compressSzFast , compressWith , compressWithSz- , decompress , compressFile , CompressionLevel (..)+ -- * Decompression+ , decompress -- * Miscellany , lZVersion , lZApiVersion@@ -71,7 +76,7 @@ let bss = BSL.toChunks bs szOut :: Integral a => a- szOut = 32 * 1024+ szOut = 64 * 1024 (dec, bufOut) <- LazyST.unsafeIOToST $ do bufOut <- mallocForeignPtrBytes szOut@@ -125,10 +130,34 @@ Nothing -> pure [] Just x -> (x:) <$> loop decoder bss' bufOut --- | Defaults to 'Six'+-- | Alias for @'compressWith' 'Six'@ compress :: BSL.ByteString -> BSL.ByteString compress = compressWith Six +-- | Alias for @'compressWithSz' 'Six'@+--+-- @since 1.0.2.0+compressSz :: BSL.ByteString+ -> Int -- ^ Size of input data, in bytes+ -> BSL.ByteString+compressSz = compressWithSz Six++-- | Alias for @'compressWithSz' 'Nine'@+--+-- @since 1.0.2.0+compressSzBest :: BSL.ByteString+ -> Int -- ^ Size of input data, in bytes+ -> BSL.ByteString+compressSzBest = compressWithSz Nine++-- | Alias for @'compressWithSz' 'Zero'@+--+-- @since 1.0.2.0+compressSzFast :: BSL.ByteString+ -> Int -- ^ Size of input data, in bytes+ -> BSL.ByteString+compressSzFast = compressWithSz Zero+ -- | Alias for @'compressWith' 'Nine'@ -- -- @since 0.3.2.0@@ -157,7 +186,7 @@ -- | @since 1.0.0.0 compressWithSz :: CompressionLevel -> BSL.ByteString- -> Int -- ^ Size of compression window+ -> Int -- ^ Size of data being compressed, in bytes. -> BSL.ByteString compressWithSz level bstr sz = runST $ do