benchmarking - Haskell Criterion Benchmark on lazy encode -


we're trying benchmark binary encoding criterion. since data types strict, able benchmark process of packing request.

however, 1 step further trying benchmark process of encode (request bytestring) using runput end getting μs-results. due lazy bytestring evaluation.

encode = runput . buildrqmessage  main =    randbytes <- getentropy 1000000   let !topica = stringtotopic "performance-0"   let !topicb = stringtotopic "performance-1"   let !clientid = stringtoclientid "benchmark-producer"   let !bytes = [randbytes | x <- [1..1]]   let !head = head 0 0 clientid   let !prod = [ totopic topica [ topart 0 bytes ] ]    defaultmain [       bgroup "encode" [              bench "pack" $ whnf (packprrqmessage head) prod            , bench "pack+build" $ whnf encode (packprrqmessage head prod)         ]     ] 

is there way benchmark encode process appropriately?


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -