[squeak-dev] advice on efficient socket programming sought

Göran Krampe goran at krampe.se
Tue Jul 22 09:20:27 UTC 2008


Hi!

Philippe Marschall wrote:
> 2008/7/18 Janko Mivšek <janko.mivsek at eranova.si>:
>> Hi Philippe,
>>
>> By efficient you mean receiving and sending a lot such data? Or what kind of
>> efficiency you want to achieve?
> 
> The data comes in chunks up to 8k. I just want to read it fast with as
> little unnecessary copies as possible. Same for writing.

IIRC SocketStream has efficient upTo: and upToAll: and also supports
#read: with a given size. I don't have an image handy so can't verify
this - but it was I who rewrote SocketStream to its current incarnation
and I took a great deal of care to make sure the code uses the
underlying methods supported by primitives and also minimizing copies
and reallocations of buffers etc.

Of course, in theory you should be able to do better "manually" of
course - but if I were you I would profile code using SocketStream and
then decide if I really need a manual approach.

regards, Göran

regards, Göran



More information about the Squeak-dev mailing list