[web-devel] new field for Network.HTTP.Types.Status

Kazu Yamamoto ( 山本和彦 ) kazu at iij.ad.jp
Wed Aug 29 07:21:59 CEST 2012


> I believe unboxing is not possible for ByteString, but it is for the Int
> field. I don't really know how much performance gains this brings, not really
> a Haskell performance guru.

I tried this:

data Status
    = Status {
        statusCode      :: {-# UNPACK #-} !Int
      , statusAsciiCode :: {-# UNPACK #-} !B.ByteString
      , statusMessage   :: {-# UNPACK #-} !B.ByteString
    deriving (Show)

Since ByteString has just one constructor, UNPACK for ByteString
should work according to GHC manual.

This results in 41345.3 req/s while no bangs and no UNPACK results in

So, let's not add bangs and UNPACKs. Please merge the current pull
request. Thanks in advance.


More information about the web-devel mailing list