Hi!
On 09/12/2011 12:35 PM, Sven Van Caekenberghe wrote:
The problem is that the new SocketStream implementation worked fine for me
during development (on Mac), but later I found out that there are subtle but
critical problems on the other platforms.
Just a few words about the SocketStream implementation. I wrote the
current incarnation of SocketStream (unless it has changed under Pharo -
haven't looked) and one important aspect of the rewrite was to make it
much faster than the old code written originally by Bolot Kerimbaev back
in... ancient times.
Basically two things make it fast:
- As little copying as possible.
- Making sure code lands on good primitives.
An example of the former is the logic involved in dealing with the
buffer growing etc.
An example of the latter is upToAll: that could be written naively and
end up using next, next for each byte. Ouch.
Anyway, there are indeed some methods in SocketStream that "hurts the
eyes", like upToAll: but that is mainly because we are lacking a
primitive for searching that has a "stopAt" argument. I never got around
to extending the one we have with such an argument.
regards, Göran