I think the Maxima manual should mention somewhere to be
careful about using endcons, because it makes a copy of the
list, rather than cons which doesn't make a copy. If
possible you should either build the list in the reverse
order or make a final call to reverse. This is certainly
common knowledge to lisp programmers and Maxima developers.
When building a very large list, I find the factor in speed is
orders of magnitude.
I searched 1) The Maxima manual 2) The Maxima Book,
3) the list archives since 2000.
Altogether, there are two references to the issue. I
was clued by this single oblique reference in the book:
endcons(elem,list) returns an (unshared) list where ...
The second reference is in a post from Jaime Villate 2007.
Thanks,
John