#19585: Improve efficiency of calling GAP functions
-------------------------------------+-------------------------------------
       Reporter:  jaanos             |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.10
      Component:  interfaces         |   Resolution:
       Keywords:  GAP functions      |    Merged in:
  interface                          |    Reviewers:
        Authors:  Janoš Vidali       |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  62bd5710559065d03a64aed7b8611cdc6842b278
  u/jaanos/improve_efficiency_of_calling_gap_functions|     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by tscrim):

 I suspect the reason we are seeing a slowdown in these smaller function
 calls is because of the extra GAP call:
 {{{#!python
 if self.eval('IsIdenticalObj(__SAGE_VAL__, __SAGE_LAST__)') != 'true':
 }}}
 I think we could probably just check if `res` is non-empty:
 {{{#!python
 self.eval('__SAGE_LAST__ := "__SAGE_LAST__";;')
 res = self.eval("%s(%s);;"%(function, ",".join([s.name() for s in args]+
                 ['%s=%s'%(key,value.name()) for key, value in
 kwds.items()])))
 if not res: # No printing was done
     return self.new('last')
 # Check to see if something was printed and ignore it
 self.eval("__SAGE_VAL__ := last;;")
 if self.eval('IsIdenticalObj(__SAGE_VAL__, __SAGE_LAST__)') != 'true':
     return self.new('__SAGE_VAL__')
 # Otherwise just print the printed output
 if res.strip():
     from sage.interfaces.expect import AsciiArtString
     return AsciiArtString(res)
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/19585#comment:6>
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 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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to