[squeak-dev] advice on efficient socket programming sought

Janko Mivšek janko.mivsek at eranova.si
Tue Jul 22 10:02:44 UTC 2008


Philippe Marschall wrote:

>> 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.

While optimizing Swazoo I found two things most important for really 
fast and sustainable socket performance, on all Smalltalks:

1. avoiding garbage collection for all costs. For that reason there is a 
special SwazooStream with SwazooBuffer, which reuse buffers instead of 
copying and recreating them, which it is just too usual in existing 
stream implementations.

2. proper packaging of packets before sending (flush) to avoid sending 
to many too little packets on the net, which causes big overhead because 
of packet headers. In SwazooBuffer there is currently 8KB buffer size, 
which fits well in ethernet frame.

Best regards
Janko

-- 
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si



More information about the Squeak-dev mailing list