[Haskell-cafe] code review? store server, 220loc.

Tim Newsham newsham at lava.net
Mon Aug 4 23:45:33 EDT 2008


> You should try profiling this. I can see a few possible problems (such
> as reading String from a socket, instead of a ByteString), but it's
> difficult to predict what might be causing your code to be so slow.
> Haskell code ought to be much more competitive with C for an
> application like this.

I haven't tried profiling yet, I should do that (ugh, will prob
have to rebuild some libraries I'm using to support that).

Anyway, I haven't yet used any ByteString IO functions.  I ran
some tests when I was starting and it seems that using Handle IO
functions was a bit slower than using the Socket IO functions directly.
It looks like there are a bunch of Handle IO functions that can
return ByteStrings but I don't see any for sockets...  Are there any?
If not, I suspect it will be a wash switching to Handles and ByteStrings
(especially since most of my requests and responses are quite small).

I'll write up some tests to see how well those perform..

Tim Newsham
http://www.thenewsh.com/~newsham/


More information about the Haskell-Cafe mailing list