[Haskell-cafe] ANN: network-2.2.3, merger with network-bytestring

Christopher Done chrisdone at googlemail.com
Sun Oct 31 13:56:27 EDT 2010

On 31 October 2010 16:14, Johan Tibell <johan.tibell at gmail.com> wrote:
> This version marks the end of the network-bytestring package, which
> has now been merged into the network package. This means that
> efficient and correct networking using ByteStrings is available as
> part of the standard network package.
> As part of the merger, two new modules have been added:
> Network.Socket.ByteString and Network.Socket.ByteString.lAzy

Huzzah! I updated my little throttler program to use ByteString.[1]

One thing I'm curious about, that maybe you probably know off the top
of your head, is that when I'm limiting the speed, I was merely
recv'ing and send'ing at 1024 bytes a pop[2], however, when I did this
at, say, ~500KB/s, Firefox is really slow at receiving it, whereas
when I set it 4096 it's much faster/more accurate to the speed I
intend. Chrome doesn't seem to care.

I think the difference is that Firefox is single threaded
(select/poll-based?) and has to switch between various jobs while
receiving every tiny block that I'm sending. Chrome probably has the
receiver in a separate process.

So it seems like, short of balancing the package size (at powers of 2)
and the delay to get some ideal throughput, it's easiest and probably
realistically equivalent to set it to 4096 and just rely on an
accurate delay? What do you think? Just curious. This is something I
think I'll look into in the future, I really don't have a good feel
for typical network latency and throughput. It's not a big deal right
now as "56k slow" is all I need to test my web app.

[1]: http://github.com/chrisdone/throttle/commit/97e03bfc64adc074c9d1f19c2605cb496576c593
[2]: http://github.com/chrisdone/throttle/commit/30dc1d970a7c0d43c1b6dc33da9deecf30808114

More information about the Haskell-Cafe mailing list