From: Lyman S. Taylor
Subject: Re: why is this code inefficient??
Date: 
Message-ID: <6pnri9$j1d@pravda.cc.gatech.edu>
In article <······················@omikron.medizin.uni-ulm.de>,
kp gores <·····@sip.medizin.uni-ulm.de> wrote:
>at the end of this posting is some easy code i wrote to convert a file
>from one format to another.
....
>, each freeing about 2mb. 
>why is this code so inefficient? where do i waste so much space??
...
>     (setf spelling (mytrim (subseq line 0 23))) ;; doc: 1-25
...
>     (setf word-class-code (mytrim 
...
>                             (subseq line 46 69)))) ;; doc: 51-70

  As outlined in an earlier response, the subseq creates a new sequence.  
  You could perhaps use a fixed size "buffer"  and "fill" it from line using 
  replace. 

      (replace  buffer  line :start1 0 :end1 23  :start2 0 :end 23 )

      (replace  buffer  line :start1 0 :end1 23  :start2 46 :end 69 )

  which negates the copies that subseq would produce.  Since my-trim
  makes a copy (in most cases) ... you can use the same buffer for each. 
  To be safe a seperate buffer for each case. 




-- 
					
Lyman S. Taylor           "Computers are too reliable to replace
(·····@cc.gatech.edu)     	 humans effectively."
			        Commander Nathan Spring, "Starcops"