Skip to content

Commit 3b6c72e

Browse files
Binary file for loop benchmark
1 parent 4d123e9 commit 3b6c72e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

bench/Bench.hs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,11 @@ benchLoop :: IO ()
156156
benchLoop = do
157157
counter <- newIORef 0 :: IO (IORef Word)
158158
content <- newIORef "" :: IO (IORef BL.ByteString)
159-
-- TODO read file
160-
!bs <- B.readFile "1.txt"
159+
-- File contains a PostgreSQL binary response on the query:
160+
-- "SELECT typname, typnamespace, typowner, typlen, typbyval,
161+
-- typcategory, typispreferred, typisdefined, typdelim,
162+
-- typrelid, typelem, typarray from pg_type"
163+
!bs <- B.readFile "bench/pg_type_rows.out"
161164
writeIORef content . BL.cycle $ BL.fromStrict bs
162165

163166
let handler dm = case dm of
@@ -170,7 +173,10 @@ benchLoop = do
170173
let res = preBs <> ( BL.toStrict nb)
171174
res `seq` pure res
172175
tid <- forkIO . forever $ loopExtractDataRows newChunk handler
173-
threadDelay 10000000
176+
threadDelay $ durationSeconds * 1000 * 1000
174177
killThread tid
175178
s <- readIORef counter
176-
print $ "Data messages parsed: " ++ show s
179+
print $ "Data messages parsed per second: "
180+
++ show (s `div` fromIntegral durationSeconds)
181+
where
182+
durationSeconds = 10

bench/pg_type_rows.out

35.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy