Path: utzoo!attcan!uunet!decwrl!shelby!neon!michaelg From: michaelg@Neon.Stanford.EDU (Michael Greenwald) Newsgroups: comp.lang.lisp Subject: Re: Why is (read) slow? Message-ID: <1990Oct1.123907.24074@Neon.Stanford.EDU> Date: 1 Oct 90 12:39:07 GMT References: <20644@orstcs.CS.ORST.EDU> Organization: Computer Science Department, Stanford University Lines: 29 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? If you use (read) it must parse the file character by character, tokenize it, (albeit usually by a relatively efficient FSM). If you use (load ...) then you are presumably loading already parsed data structures. On many implementations an array of numbers, for example, will usually LOAD much faster than it can be READ. Perhaps I'm misunderstanding you. Perhaps you are comparing two ascii files whose only difference is that the latter one has forms like (SETQ A '( ... s-expressions ...)) instead of plain s-expressions? If so, then both have to be (READ), so it would be hard for someone to explain why LOAD is so much faster than READ without knowing more details about the particular files you are talking about. >-- >Thomas G. Dietterich >Department of Computer Science >Dearborn Hall, 303 >Oregon State University