>> I wonder -- if Maxima's basic arithmetic -- e.g., simplifying 1+2 --
>> is super slow for some abstract reason, I wonder if it is taking
>> longer and longer to compute the next prompt number.  That would be
>> pretty funny.  Is there any way to turn off the prompt numbers?
>>
>> Help! What is going on!?
>
> The slowdown is probably caused by makelabel in suprv1.lisp. It check
> that the list containing all labels does not contain the new label
> which it generates. After you create 2*35150 labels, this takes longer
> than when maxima starts.
>
> If this is true the slowdown should be decreased if you add
> nolabels:true; at the top of in.
>
> Andrej

As Harald points out, this solves our slowdown problem.  Great work, and
many thanks (and also to Robert Dodier who independently came to the same
conclusion)!!

Anyway, patch up at

http://trac.sagemath.org/sage_trac/ticket/6818

I hope somebody referees this ASAP so it gets into Sage-4.1.2, since it's
very simple and will result in massive speedups for some computations.

Here's the responsible lisp code by the way from suprv1.lisp:

(defmfun makelabel (x)
 (when (and $dskuse (not $nolabels) (> (incf dcount) $filesize))
    (setq dcount 0)
   (dsksave))
  (setq linelable ($concat '|| x $linenum))
 (unless $nolabels
    (when (or (null (cdr $labels))
             (when (member linelable (cddr $labels) :test #'equal)
                (setf $labels (delete linelable $labels :count 1 :test
#'eq)) t)
             (not (eq linelable (cadr $labels))))
      (setq $labels (cons (car $labels) (cons linelable (cdr $labels))))))
 linelable)


Is this really doing a linear search through the entire list of labels?
This reminds me of the difference in Python between:

sage: v = ... make a python list ...
sage: foo in v
True

and

sage: v = ... make a python list ...
sage: w = set(v)
sage: foo in w
True

where the last line is massively faster since it uses the a hash table, but
the former is very slow since it must use a linear search through the list.
Of course, before Python 2.4 there was no "set", so the latter was more ugly
to write (one hacked it using dictionaries).

Does lisp have hash tables?  :-)

 -- William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to