Path: utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!ukma!tut.cis.ohio-state.edu!rutgers!orstcs!urania.CS.ORST.EDU!ruffwork From: ruffwork@urania.CS.ORST.EDU (Ritchey Ruff) Newsgroups: comp.lang.lisp Subject: Re: The best way to save data Keywords: save, load, lisp, Database Message-ID: <7943@orstcs.CS.ORST.EDU> Date: 16 Dec 88 14:57:41 GMT References: <627@wucs1.wustl.edu> Sender: usenet@orstcs.CS.ORST.EDU Lines: 30 I'm in lisp and build a large data structure, then want to save it to a file to read in later. assume it's bound to the atom *foo*, the problem is the reader is slow and unless you want it even slower (by setting *PRINT-CIRCLE*) you loose shared structure when you read it back in. The next trick gets around both. This is what "foo.lisp" looks like - ;;; foo.lisp assumes *foo* is bound to the data structure ;;; you want to read back in later. compile-file this ;;; file to get a fasl file that will load quickly and ;;; maintain shared structure that was in the original *foo* ;;; (in-package 'foo) ; or whatever you want... ;;; (setq *foo* '#.*foo*) then from lisp you do > (setq *foo* ) (...) > (compile-file "foo") Of course this is not human readable, and the output will only read back into the lisp it was compiled from, but if you are like me and need to dump 2 to 10 Meg structures to files then read them back in this saves 2 to 5 minutes of load time... good luck, --ritchey ruff