Subject: Re: corba or sockets?
From: Erik Naggum <erik@naggum.net>
Date: 30 Oct 2000 20:13:52 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3181925632541238@naggum.net>

* Fernando Rodríguez <spam...@must.die>
| Could you elaborate on this, with some example, please?

  Why?

  Consider the "normal" way people implement streams, with a single
  buffer that is over-written with new data as the reading crashes
  into the right buffer wall and then continues from the left end of
  the buffer.  This is not smart in a modern world.

  Instead of crashing into a buffer wall, have several buffers.  Ask
  the operating system to fill them for you while you're more or less
  busy processing the data already read, as in "asynchronously".  The
  operating system is doing a decent job of predicting your linear
  progression through the file, anyway, so it sort of works to crash
  into buffer walls and get first aid from the operating system and
  get back on your feet, but it is far from optimal, and no matter
  what you do with that system call, it at _least_ has to copy the
  buffer contents from system memory to user memory, which is also
  probably at a really bad alignnment for hardware support for such
  copying.  Several page-aligned buffers can cause I/O to occur at the
  operating system's discretion, copying is not needed if the
  operating system can map the page directly into user space, and you
  can scan through a large file in no time compared to these false
  stops and starts as you crash into buffer walls.

  Consider the sending of mail to someone with SMTP.  As long as you
  have well-defined state transitions that are (fairly) independent,
  send a whole bunch of commands down the wire and match the responses
  to the requests sent instead of waiting for each response by itself.
  Consequence?  _Dramatic_ speedup when sending to many recipients.

  In normal human life, you don't get paralyzed and die if you don't
  an answer to a question, but (carefully) go on with assumptions
  because you probably have a pretty good idea what kind of answer
  you're going to get.  Just how many code paths could you possibly
  walk down depending on the answer?  Do them all!  You certainly have
  the time while the bits trickle across the globe.
  
#:Erik
-- 
  Does anyone remember where I parked Air Force One?
                                   -- George W. Bush