Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!shelby!neon!kanamori From: kanamori@Neon.Stanford.EDU (Atsushi Kanamori) Newsgroups: comp.lang.lisp Subject: Re: Why is (read) slow? Message-ID: <1990Oct2.211856.632@Neon.Stanford.EDU> Date: 2 Oct 90 21:18:56 GMT References: <20644@orstcs.CS.ORST.EDU> Organization: Computer Science Department, Stanford University Lines: 39 In article <20644@orstcs.CS.ORST.EDU> tgd@tesla.cs.orst.edu (Tom Dietterich) writes: >Frequently I use large files of S-expressions as a database for moving >information from one lisp program to another. I find that using >(read) to read these expressions back into lisp is extremely slow. >If, however, I set up the file so that it can be (load)-ed instead, it >comes in much much faster. Have other people observed this? Has >anyone got an explanation? > Gee, you got me. Perhaps you might check up on the following theory? 1. Whoever wrote your Lisp system hard-coded the parser into his "load" command without thinking about the fact that the parser is needed separately. 2. Later, he realizes that Lisp also requires a "read" interface to the parser. 3. Groans and slaps his head. 4. Rather than rewrite the parser, codes up "read" as follows: a. Copy characters from input stream to a /tmp file. b. Do quick scan to find s-expression boundaries and edit /tmp file to change SEXPR into (setq tmpvar 'SEXPR) c. Calls "load" to read in /tmp file. d. Returns value of tmpvar. o o | (a big smiley for above paragraph) \ | / \_____/ P.S.: Maybe your "load" command is secretly caching a preprocessed version of your datafiles?