I have committed about twenty or so patches reimplementing the functions that operate on sequences. More precisely, REMOVE, DELETE, [N]SUBSTITUTE, POSITION, FIND, COUNT are implemented using specialized iterations for vectors and lists. Interestingly the resulting code is not only faster, but smaller!<div>
<br></div><div>While there may be still corners to be polished, I am pretty happy about the results. I benchmarked the code below which includes two cases without consing and one that should cons a large array on each iteration. Surprisingly ECL works better than SBCL on 64-bit platforms when no consing is involved. If some consing is needed, the ECL/32-bits platform works worse but this is due to the garbage collector -- something similar is experience with plain bignums as discussed here before.</div>
<div><br></div><div>As a side effect you should find the new code much more readable and easier to maintain. Another piece of obsolete, legacy code is flushed down the toilet :-)</div><div><br></div><div>Juanjo</div><div>
<br></div><div>platform / time (seconds)</div><div><div> CASE 1 CASE 2 CASE 3</div><div>ECL/32 2.586 2.531 8.841</div><div>ECL/64 0.880 0.880 2.930</div><div>SBCL/32 3.239 2.780 3.222</div>
<div>
SBCL/64 2.209 2.052 2.206</div><div><br></div><div>(let ((a (make-array 1024 :initial-element 'a)))</div><div> (time (dotimes (i 100)</div><div> (dotimes (i 1000)</div><div> (remove 'b a :start i :end 1000)))))</div>
<div><br></div><div>(let ((a (make-array 1024 :initial-element 'a :fill-pointer 1024)))</div><div> (time (dotimes (i 100)</div><div> (dotimes (i 1000)</div><div> (setf (aref a 999) 'b</div><div>
(fill-pointer a) 1024)</div><div> (delete 'b a :start i :end 1000)))))</div><div><br></div><div>(let ((a (make-array 1024 :initial-element 'a)))</div><div> (setf (aref a 999) 'b)</div>
<div> (time (dotimes (i 100)</div><div> (dotimes (i 1000)</div><div> (remove 'b a :start i :end 1000)))))</div><div><br></div>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br>
<a href="http://tream.dreamhosters.com">http://tream.dreamhosters.com</a><br>
</div>