Opened 9 years ago

Last modified 7 years ago

#10296 closed enhancement

Singular interface wasting time by calling select.select() too often — at Initial Version

Reported by: SimonKing Owned by: was
Priority: major Milestone: sage-5.0
Component: interfaces Keywords: Singular, _eval_line, synchronization, synchronisation
Cc: was, wjp, AlexanderDreyer, malb, leif Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

There are two fundamental differences between the Singular and the Gap interfaces:

  1. The Singular interface uses a synchronisation method in each call to its eval method. Gap doesn't.
  2. The Gap interface deletes variables by declaring that their name may be overwritten. This is not possible in Singular, since Singular variables are statically typed. Thus, the Singular interface explicitly kills the underlying variable in Singular, which requires one call to _eval_line for each variable that is to be deleted.

Unfortunately, waiting for the prompt to appear in a pseudo terminal may be very costly on some systems, since select.select() may be very slow - see #10294. So, additional calls to _eval_line should be strictly avoided!

The first point makes me wonder: Why has the synchronisation method become necessary for Singular but not for Gap?

The second point makes me wonder whether it is really necessary to use one _eval_line for each single deletion.

Moreover, I wonder whether the two points are actually related: I could imagine that synchronisation became necessary when garbage collection, accidentally performed inside an _eval_line, and thus sending an _eval_line inside an outer _eval_line, caused a dead lock in the outer _eval_line. Was that the case, historically?

Suggestions:

  1. singular.eval(cmd) is currently simply passing cmd to _eval_line, after synchronisation and after killing unused variables. I suggest to add the code for killing unused variables to cmd, thus using _eval_line only once.
  2. If my above guess on the role of synchronisation is correct, then one could simply drop synchronisation after implementing my first suggestion.

This is related with #10294 and perhaps with #10295. Cc to William and Willem-Jan, since they wrote the synchronisation code.

Change History (0)

Note: See TracTickets for help on using tickets.