newsham: > Anyone interested in critiquing some code? I'm looking for ideas > for making it faster and/or simpler: > > http://www.thenewsh.com/%7Enewsham/store/Server5.hs > > This is an exercise to see how well a server in Haskell would perform. > My goals are roughly: > - retargetability to other server types (ie. easy to > replace request and response structures and business logic). > - readability. > - performance. > > My measurements show that a simple dummy server (accept, forkio, > recv byte) handles roughly 7500 requests/connects per second, > the server/client that do real messages do about 4500 req and > connections per second. If all requests are on the same connection > one after another it does about 13500 requests/second. For > comparisons, a C ping-pong server does about 3600/second if > it has to fork for each new connection/request, and about 35000/sec > if its all on the same connection. So it seems at least competitive > with a forking C server. I havent tested threaded C servers. >
packBS :: String -> B.ByteString packBS = B.pack . map (toEnum.fromEnum) -- | Convert a bytestring to a string. unpackBS :: B.ByteString -> String unpackBS = map (toEnum.fromEnum) . B.unpack are Data.ByteString.Char8.pack/unpack. What optimisation and runtime flags did you use (-threaded or not?) _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe