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

Re: union, intersection etc. cons too much with &key arguments



Jörg-Cyril Höhle <hoehle@zeus.gmd.de> noticed:

> > (time (intersection '(1 2 3 4 5 6 7 8 9) '(a b c d e f g h i j k l) :test #'eql :key #'identity))
> 
> Real time: 0.0 sec.
> Run time: 0.0 sec.
> Space: 608 Bytes
> ...
>
> Instead of
>               if (flags & bit(0)) { NEXT(ptr1) = unbound; } # Rest-Parameter
> there could be a loop similar to apply_cclosure_rest_nokey: where only
> <args_on_stack> values need be pushed onto <args>, constructing the &REST
> list in apply_closure() and not in match_cclosure_key().

The consing overhead of APPLYing a function with both &REST and &KEY will
be a little more optimized in the next version. Thanks for noticing this
opportunity for improvement.

                            Bruno