[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: remove

In article <SIMON.92Nov23130108@liasg2.epfl.ch> Simon Leinen,
simon@lia.di.epfl.ch writes:
>Espen is correct in that Hallvard's REMOVE variant isn't
>tail-recursive and may therefore cause problems with long lists.  One
>could code an iterative tail-preserving version (which might be slower).
>But I did some benchmarking on Sun-4s under Allegro and CMU CL, and even
>on longish lists (like 1000 elements or so), Hallvard's FASTER-REMOVE
>performed better on the whole than the system-provided REMOVE versions.
>I would bet that at least 90% of the uses of REMOVE would benefit from

Yes, especially if you take into account that if you're using very long
lists as your data structures, you are probably using the wrong kind of
data structure.
I guess a lot of programs might benefit even more from _memoizing_ the
remove function, i.e. if the program is using remove to filter the same
list again and again, it would benefit from knowing that, e.g., a given
value isn't present in that list at all.
Espen J. Vestre,                          espen@coli.uni-sb.de
Universitaet des Saarlandes,        
Computerlinguistik, Gebaeude 17.2 
Im Stadtwald,                          tel. +49 (681) 302 4501
D-6600 SAARBRUECKEN, Germany           fax. +49 (681) 302 4351