Avoid unneeded writes
This commit is contained in:
parent
03860c370a
commit
00e585281c
@ -29,6 +29,7 @@ import qualified Data.ByteString.Lazy.Char8 as LBC
|
|||||||
import System.IO.Unsafe (unsafeInterleaveIO)
|
import System.IO.Unsafe (unsafeInterleaveIO)
|
||||||
import Control.Parallel.Strategies (rseq, parMap)
|
import Control.Parallel.Strategies (rseq, parMap)
|
||||||
import qualified Data.List as L
|
import qualified Data.List as L
|
||||||
|
import Control.Monad (unless)
|
||||||
|
|
||||||
combine :: (MonadUnliftIO m, MonadResource m, MonadThrow m, MonadIO m) => ConduitM FilePath Header m ()
|
combine :: (MonadUnliftIO m, MonadResource m, MonadThrow m, MonadIO m) => ConduitM FilePath Header m ()
|
||||||
combine = await >>= \case
|
combine = await >>= \case
|
||||||
@ -47,6 +48,7 @@ run = do
|
|||||||
original <- Set.fromList . map LBS.toStrict . lbsLines <$> LBS.readFile datFile
|
original <- Set.fromList . map LBS.toStrict . lbsLines <$> LBS.readFile datFile
|
||||||
xs <- LBS.getContents >>= stream
|
xs <- LBS.getContents >>= stream
|
||||||
let set = original `Set.union` F.fold (parMap rseq F.fold (chunks 20 xs))
|
let set = original `Set.union` F.fold (parMap rseq F.fold (chunks 20 xs))
|
||||||
|
unless (original == set) $
|
||||||
runResourceT $
|
runResourceT $
|
||||||
runConduit $
|
runConduit $
|
||||||
CL.sourceList (Set.elems set)
|
CL.sourceList (Set.elems set)
|
||||||
|
Loading…
Reference in New Issue
Block a user