On Tue, Oct 10, 2017 at 10:30 AM, Bill Page <[email protected]> wrote: > The function 'first' in the List domain calls SPADfirst$Lisp which is > a rather clever Lisp macro > > (defmacro |SPADfirst| (l) > (let ((tem (gensym))) > `(let ((,tem ,l)) (if ,tem (car ,tem) (first-error))))) > > that seems to have no more measurable overhead than calling QCAR. > Perhaps someone with more Lisp experience than me can explain it?
Well, it's the difference between (if x (car x)) and (car x). > I think probably that (NULL (NULL x)) is optimized by Lisp (at least by > SBCL). Yes, but at Spad level, (CONSP X) is inlined, while (NULL (NULL x)) is not inlined, which involves a ELT lookup and a function call. BTW, your benchmarking might be misleading, because when you modify a previously inlined function to not-inlined, then the previous inline information is still in the system. This should be considered a small annoying bug. AKA if you modified a inline domain, you should compile FriCAS again to do benchmark. -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
