#13991: Mitigate speed regressions in symmetric function related code due to
#12313
---------------------------------+------------------------------------------
Reporter: nbruin | Owner: sage-combinat
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.7
Component: combinatorics | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
---------------------------------+------------------------------------------
Comment (by SimonKing):
With #12313, I get
{{{
sage: from sage.combinat.sf.k_dual import DualkSchurFunctions
sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
sage: dks4 = DualkSchurFunctions(Sym.kBoundedQuotient(4))
sage: X=dks4[0]+ 2*dks4[1] + 3*dks4[2]
sage: X*X
dks4[] + 4*dks4[1] + 4*dks4[1, 1] + 10*dks4[2] + 12*dks4[2, 1] + 9*dks4[2,
2] + 12*dks4[3] + 9*dks4[3, 1] + 9*dks4[4]
sage: import cProfile,pstats
sage: cmd = "X*X"
sage: s=pstats.Stats(cProfile.Profile().runctx(cmd,globals(),{}))
sage: Sc=s.sort_stats('calls')
921582 function calls (903323 primitive calls) in 10.401 seconds
Ordered by: call count
ncalls tottime percall cumtime percall filename:lineno(function)
112808 1.279 0.000 2.634 0.000 {repr}
98409 0.121 0.000 0.121 0.000 {id}
96993 0.372 0.000 0.491 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/structure/unique_representation.py:531(__hash__)
56876 0.309 0.000 0.309 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/partition.py:4003(__repr__)
56809 0.113 0.000 0.113 0.000 {cmp}
56404 0.451 0.000 3.198 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/combinat.py:1051(__cmp__)
54058 0.159 0.000 0.159 0.000 {isinstance}
42834 0.099 0.000 0.099 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/rational_field.py:217(__hash__)
42480 0.234 0.000 0.234 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/polynomial/polynomial_ring.py:716(__hash__)
42127 0.436 0.000 0.668 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/polynomial/polynomial_ring.py:1369(_repr_)
42127 0.232 0.000 0.232 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/polynomial/polynomial_ring.py:725(_repr_)
28124/11520 1.748 0.000 5.921 0.001 {method
'has_coerce_map_from' of 'sage.structure.parent.Parent' objects}
15235 0.040 0.000 0.040 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/structure/unique_representation.py:473(__eq__)
14501 0.019 0.000 0.019 0.000 {method 'base_ring' of
'sage.structure.category_object.CategoryObject' objects}
14278 0.035 0.000 0.035 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/rational_field.py:220(_repr_)
14160 0.091 0.000 0.723 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/rational_field.py:261(_coerce_map_from_)
14043 0.346 0.000 0.571 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/fraction_field.py:380(_repr_)
14042 0.713 0.000 2.083 0.000 {method 'coerce_map_from' of
'sage.structure.parent.Parent' objects}
14042 0.060 0.000 0.108 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/polynomial/polynomial_ring.py:189(is_PolynomialRing)
14042 0.400 0.000 2.630 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/polynomial/polynomial_ring.py:468(_coerce_map_from_)
14042 0.021 0.000 0.021 0.000
{sage.rings.polynomial.multi_polynomial_ring_generic.is_MPolynomialRing}
13924 0.685 0.000 5.909 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/fraction_field.py:194(_coerce_map_from_)
3344 0.009 0.000 0.009 0.000 {built-in method __new__ of
type object at 0x7faac21514a0}
3344 0.019 0.000 0.027 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python/weakref.py:223(__new__)
3344 0.024 0.000 0.024 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python/weakref.py:228(__init__)
2245 0.007 0.000 0.007 0.000 {getattr}
2116 0.013 0.000 0.013 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/fraction_field.py:430(ring)
1768 0.003 0.000 0.003 0.000 {len}
1493 0.007 0.000 0.007 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/combinat.py:840(__hash__)
1356 0.009 0.000 0.009 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/infinity.py:942(__init__)
1356 0.028 0.000 0.053 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/infinity.py:883(_element_constructor_)
1281/809 0.058 0.000 0.087 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/misc/lazy_attribute.py:506(__get__)
1257 0.016 0.000 0.049 0.000 {hasattr}
1146 0.003 0.000 0.003 0.000 {setattr}
993 0.005 0.000 0.009 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/rings/infinity.py:285(__cmp__)
842/136 0.004 0.000 9.752 0.072 {sum}
827 0.029 0.000 0.066 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/partition.py:3510(Partitions)
765 0.003 0.000 0.004 0.000 {method 'get' of 'dict'
objects}
618 0.001 0.000 0.001 0.000 {method 'parent' of
'sage.structure.element.Element' objects}
613 0.003 0.000 0.005 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/combinat.py:872(__getitem__)
613 0.001 0.000 0.001 0.000 {method '__getitem__' of
'list' objects}
590 0.009 0.000 0.074 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/partition.py:2716(parent)
590 0.002 0.000 0.002 0.000 {method 'category' of
'sage.structure.parent.Parent' objects}
590 0.003 0.000 0.003 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/partition.py:3978(__init__)
548 0.004 0.000 0.005 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python/re.py:226(_compile)
548 0.006 0.000 0.006 0.000 {method 'sub' of
'_sre.SRE_Pattern' objects}
548 0.004 0.000 0.014 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python/re.py:144(sub)
517 0.007 0.000 0.011 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/combinat.py:667(__init__)
482 0.002 0.000 0.002 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/combinat.py:886(__iter__)
472 0.002 0.000 0.002 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/categories/homset.py:589(domain)
472 0.082 0.000 0.154 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/categories/homset.py:353(__init__)
472 0.002 0.000 0.046 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/categories/sets_cat.py:255(_element_constructor_)
472 0.001 0.000 0.001 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/categories/homset.py:592(codomain)
472 0.059 0.000 0.248 0.001
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/categories/homset.py:80(Hom)
437 0.006 0.000 0.032 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/combinat.py:1139(_element_constructor_)
413 0.005 0.000 0.005 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/free_module.py:34(__init__)
413 0.007 0.000 0.015 0.000
/home/simon/SAGE/debug/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/combinat/free_module.py:2142(_from_dict)
}}}
I do find it strange that 472 homsets are created, but apparently this
does not contribute much to the computation time - at least not directly.
I am afraid the problem is not clear to me from these statistics. But
perhaps a comparison with the pre-#12313 state gives a clue?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13991#comment:4>
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.