Subject: Re: Good I/O performance
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1998/04/18
Newsgroups: comp.lang.lisp
Message-ID: <6ha54j$2ses3@fido.asd.sgi.com>

Erik Naggum  <clerik@naggum.no> wrote:
+---------------
|   ...  it would be so
|   cool if there was a subtype of string that was really a file on disk
|   through the available operating system mechanisms.  this _may_ be
|   obtained with various smart ways to return strings from some foreign
|   function to Lisp, but I'm not that brave, yet.  in my dreams, one could,
|   say, open the file the normal way, and then a function FILE-CONTENTS
|   would return a (vector (unsigned-byte 8)) or a string that would be
|   mapped onto the file.
+---------------

What an amazing coincidence! I was just mulling over similar ideas today as
possible solutions to some abyssmal performance problems in a Scheme-based
mail filter program I'm hacking on. Clearly the "obvious" approach is to
mmap the file (in Unix, at least) and to create [unfortunately, by hacking
into the internals of the implementation] am "indirect" flavor of string
that when garbage collected would un-mmap the file.

And then once you have such "indirect" strings, it should be nearly trivial
to then add shared-structure substrings, yes? (...provided that the base
string is read-only, to prevent side-effects.)


-Rob

-----
Rob Warnock, 7L-551		rpw3@sgi.com   http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673 [New area code!]
2011 N. Shoreline Blvd.		FAX: 650-933-4392
Mountain View, CA  94043	PP-ASEL-IA