Skip to content

Instantly share code, notes, and snippets.

0.517 ( 0.002 ms): ms_pipe_read/3487 recvfrom(fd: 85<socket:[541387]>, ubuf: 0x556139607000, size: 4096, flags: DONTWAIT) = -1 EAGAIN Resource temporarily unavailable
__libc_recv+0xffff011268d9a07f (/usr/lib64/libpthread-2.24.so)
Pipe::do_recv+0xffff553da7af2044 (/usr/bin/ceph-osd)
Pipe::buffered_recv+0xffff553da7af207f (/usr/bin/ceph-osd)
Pipe::tcp_read_nonblocking+0xffff553da7af2033 (/usr/bin/ceph-osd)
Pipe::tcp_read+0xffff553da7af206d (/usr/bin/ceph-osd)
Pipe::reader+0xffff553da7af2237 (/usr/bin/ceph-osd)
Pipe::Reader::entry+0xffff553da7af200d (/usr/bin/ceph-osd)
start_thread+0xffff011268d9a0ca (/usr/lib64/libpthread-2.24.so)
__clone+0xffff01126c3da05f (/us

Keybase proof

I hereby claim:

  • I am tsuraan on github.
  • I am tsuraan (https://keybase.io/tsuraan) on keybase.
  • I have a public key whose fingerprint is 4312 8CD3 BDC9 77CD E86C EF15 7989 C077 78A4 D037

To claim this, I am signing this object:

Prelude> let c = Data.ByteString.Lazy.cycle
Loading package bytestring-0.9.1.7 ... linking ... done.
Prelude> let p = Data.ByteString.Lazy.Char8.pack
Prelude> let bfoldr = Data.ByteString.Lazy.foldr
Prelude> let bs = c $ p "hello there"
Prelude> let hasher w ~(pos, hash, lst) = let nhash = hash+(fromIntegral w) in if nhash > 2 then (pos+1, nhash, pos:lst) else (pos+1, nhash, lst)
Prelude> let (_,_,ans) = bfoldr hasher (0, 2, []) bs
Prelude> head ans
^CInterrupted.
{-# LANGUAGE BangPatterns #-}
import Data.Digest.Adler32 (adler32)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import Criterion.Main
import System.IO
import Data.Word
import Data.Bits
-- using instead of generic Strict Pair (c.f. High-Performance Haskell) lets
{-# LANGUAGE BangPatterns #-}
import Data.Digest.Adler32 (adler32)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import Criterion.Main
import System.IO
import Data.Word
data PairS a b = PS !a !b
Sun Jun 5 12:42 2011 Time and Allocation Profiling Report (Final)
Easy +RTS -prof -RTS
total time = 19.48 secs (974 ticks @ 20 ms)
total alloc = 9,680,503,112 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
BS.index Main 69.2 76.3
{-# LANGUAGE BangPatterns #-}
import Data.Digest.Adler32 (adler32)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import System.IO
import Data.Word
updateHash :: Word32 -> Word8 -> Word32 -> Word8 -> Word32
updateHash _winlen old8 !hash word8 = hash + (fromIntegral $ old8 + word8)
{- actual adler32 sliding window code goes here -}
warming up
estimating clock resolution...
mean is 15.79065 us (40001 iterations)
found 1344 outliers among 39999 samples (3.4%)
1235 (3.1%) high severe
estimating cost of a clock call...
mean is 2.088917 us (49 iterations)
found 2 outliers among 49 samples (4.1%)
1 (2.0%) high mild
1 (2.0%) high severe
import Data.Word
import Criterion.Main
fi :: Word8 -> Word32
fi = fromIntegral
main = defaultMain [ bgroup "words" [ bench "noconvert" $ nf id (0 :: Word32)
, bench "convert" $ nf fi 0 ]]
10,429,347,888 bytes allocated in the heap
3,865,080 bytes copied during GC
16,798,864 bytes maximum residency (2 sample(s))
1,063,280 bytes maximum slop
18 MB total memory in use (0 MB lost due to fragmentation)
Generation 0: 19859 collections, 0 parallel, 0.28s, 0.30s elapsed
Generation 1: 2 collections, 0 parallel, 0.00s, 0.00s elapsed
INIT time 0.00s ( 0.00s elapsed)