[plt-scheme] Savers: Superceding

From: YC (yinso.chen at gmail.com)
Date: Thu Feb 18 04:07:18 EST 2010

On Wed, Feb 17, 2010 at 8:18 PM, Synx <plt at synx.us.to> wrote:

>
> I tried making custom ports, but that was a mess too. I don't want or
> care about special values, lines, source code locations or peeking. All
> I want is something that consumes bytes, through a complex chain of
> encodings. But the chain itself has to have some way for me to
> "supercede" elements in it, when I no longer have to decode a prefix for
> instance, and all that particular saver is doing now, is just passing
> the bytes onto the next step forever.
>

I am not certain if I grasp your saver and supercede concept fully, but my
bzlib/port does handle the filter concept that allows you to chain a bunch
of filters together on top of an input-port (and output-port too), and
returns an input-port, so you can consume the data with the filters applied
dynamically.

For example - adding base64-encode & gzip filters on top of a regular text
port, and reading from it you will get data that is first gzipped and then
base64'd.

The implementation does make use of thread and pipes, as well as custom
ports, to take advantage of the built-in filter functions that all take an
input-port & an output-port.  I previously was able to run over 20K threads
simultaneously on my box, so I am surprised you are having issues with just
200 threads, but I did not do additional scalability testings to see what
the limit will be.  If such scalability issue does exist, the implementation
can be changed.

HTH.  Cheers,
yc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100218/bfb018bc/attachment.html>

Posted on the users mailing list.