#10296: Singular interface wasting time by calling select.select() too often
--------------------------+-------------------------------------------------
Reporter: SimonKing | Owner: was
Type: defect | Status: new
Priority: major | Milestone: sage-4.6.1
Component: interfaces | Keywords: Singular, _eval_line,
synchronization, synchronisation
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------+-------------------------------------------------
Comment(by SimonKing):
Committing the kills in {{{singular.eval}}} by prepending stuff to the
given command turned out to break a lot of doc tests, since they test
against the given command showing up in the output. But I think one could
be even closer to the Gap interface.
Recall that in the Gap interface, variables are freed by allowing to re-
use their names. So, memory allocated in Gap is only freed when the old
variable is actually overwritten.
In Singular, memory is freed by the command {{{kill}}}. I suggest to use
this command not inside {{{singular.eval}}} but inside
{{{SingularElement.__init__}}}: It is put in front of the command that
creates the new variable. Then, the analogy between Gap and Singular
interfaces is rather close: Memory in Gap or in Singular is freed only
when a new Element is created -- by overwriting the old stuff in the case
of Gap, or by killing the old stuff in the case of Singular.
Moreover, I removed the synchronisation code, since it seems to me that
synchronisation is not really necessary if the garbage collection is not
using an additional _eval_line (which is the case with my suggestion).
So, there remains only ''one'' call to select.select when creating a new
Singular element, rather than two plus the number of old variables to be
killed.
Indeed, my approach reduces the overhead in using the Singular interface
by 2/3 in the test above!
But there occur two doctest failures, that I have to deal with now.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10296#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.