#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: | 46f1391fd13052e8c684ed3e96434143a58860dc
u/jaanos/improve_calling_gap_function-19585| Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by jaanos):
Hi!
I've tried a few alternatives. First of all, for reference, the timings on
my laptop with the develop branch (i.e., 6.10.beta4):
{{{
sage: P = groups.permutation.Symmetric(7)
sage: %time S = P.conjugacy_classes_subgroups()
CPU times: user 944 ms, sys: 64 ms, total: 1.01 s
Wall time: 1.33 s
sage: P = groups.matrix.GL(3, 3)
sage: %timeit P.conjugacy_classes_representatives()
100 loops, best of 3: 3.26 ms per loop
sage: P = groups.permutation.Suzuki(8)
sage: %time S = P.conjugacy_classes_subgroups()
CPU times: user 300 ms, sys: 40 ms, total: 340 ms
Wall time: 421 ms
}}}
With the current branch, there is a small slowdown when there wasn't much
output to cut, as expected:
{{{
sage: P = groups.permutation.Symmetric(7)
sage: %time S = P.conjugacy_classes_subgroups()
CPU times: user 1.08 s, sys: 120 ms, total: 1.2 s
Wall time: 1.42 s
sage: P = groups.matrix.GL(3, 3)
sage: %timeit P.conjugacy_classes_representatives()
100 loops, best of 3: 3.31 ms per loop
sage: P = groups.permutation.Suzuki(8)
sage: %time S = P.conjugacy_classes_subgroups()
CPU times: user 220 ms, sys: 40 ms, total: 260 ms
Wall time: 343 ms
}}}
I've tried removing `IsIdenticalObj`:
{{{
#!python
marker1 = '"__SAGE_LAST1__"'
marker2 = '"__SAGE_LAST2__"'
self.eval('__SAGE_LAST1__ := %s;;' % marker1)
self.eval('__SAGE_LAST2__ := %s;;' % marker2)
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 self.eval('last2') == marker2:
return self.new('last2')
else:
...
}}}
But it seems that `IsIdenticalObj` isn't that expensive after all:
{{{
sage: P = groups.permutation.Symmetric(7)
sage: %time S = P.conjugacy_classes_subgroups()
CPU times: user 1.08 s, sys: 132 ms, total: 1.22 s
Wall time: 1.5 s
sage: P = groups.matrix.GL(3, 3)
sage: %timeit P.conjugacy_classes_representatives()
100 loops, best of 3: 3.27 ms per loop
sage: P = groups.permutation.Suzuki(8)
sage: %time S = P.conjugacy_classes_subgroups()
CPU times: user 240 ms, sys: 28 ms, total: 268 ms
Wall time: 371 ms
}}}
I've also tried making all calls in a single `eval`, but it seems that
`last` doesn't work when used in a file. So it will probably be best to
keep the latest version with `IsIdenticalObj`.
Janoš
--
Ticket URL: <http://trac.sagemath.org/ticket/19585#comment:13>
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.