on master help sign in
Avoid using dd, pipe data directly & truncate it using head

dd is confusing to work with and has it's own idiosyncracies.

commitf57243cc32e300ecceb1d6318cbc7c51cebce398 authoradithyaov <adithya@composewell.com> dateWed 28 Oct 2020, 15:55 (6 years ago) parent3a64e63
1 file changed+2−9
benchmark/Streamly/Benchmark/FileSystem/Handle.hs+2−9
benchmark/Streamly/Benchmark/FileSystem/Handle.hs+2−9
@@ -52,12 +52,6 @@ smallFileSize = 10 * 1024 * 1024
5252bigFileSize :: Int
5353bigFileSize = 100 * 1024 * 1024
5454
55−blockSize :: Int
56−blockSize = 32768
57−
58−blockCount :: Int -> Int
59−blockCount size = (size + blockSize - 1) `div` blockSize
60−
6155-------------------------------------------------------------------------------
6256--
6357-------------------------------------------------------------------------------
@@ -75,9 +69,8 @@ main = do
7569 "mkdir -p " ++ scratchDir
7670 ++ "; test -e " ++ infile
7771 ++ " || { echo \"creating input file " ++ infile
78− ++ "\" && dd if=/dev/random of=" ++ infile
79− ++ " bs=" ++ show blockSize
80− ++ " count=" ++ show (blockCount size)
72+ ++ "\" && head -c " ++ show size
73+ ++ " </dev/urandom >" ++ infile
8174 ++ ";}"
8275 runProcess_ (shell (cmd inFileSmall smallFileSize))
8376 runProcess_ (shell (cmd inFileBig bigFileSize))