#10963: More functorial constructions
-------------------------------------+-------------------------------------
       Reporter:  nthiery            |        Owner:  stumpc5
           Type:  enhancement        |       Status:  needs_info
       Priority:  major              |    Milestone:  sage-6.2
      Component:  categories         |   Resolution:
       Keywords:  days54             |    Merged in:
        Authors:  Nicolas M. Thiéry  |    Reviewers:  Simon King, Frédéric
Report Upstream:  N/A                |  Chapoton
         Branch:                     |  Work issues:
  public/ticket/10963-doc-           |       Commit:
  distributive                       |  1cdc128a85851dd007b3b77ec53a4853a10e1de4
   Dependencies:  #11224, #8327,     |     Stopgaps:
  #10193, #12895, #14516, #14722,    |
  #13589, #14471, #15069, #15094,    |
  #11688, #13394, #15150, #15506,    |
  #15757, #15759                     |
-------------------------------------+-------------------------------------

Comment (by nbruin):

 There are some performance and leaking issues with the proposed code here.
 They have been mentioned before, but they got swamped in more theoretical
 design discussions. Consider for instance without the patch:
 {{{
 sage: import gc
 sage: from collections import Counter
 sage: %time for n in [1..5000]: x=(matrix(Integers(n),2,2,1))
 CPU times: user 5.25 s, sys: 0.02 s, total: 5.27 s
 Wall time: 5.34 s
 sage: gc.collect()
 13714
 sage: [c for c in Counter([type(a) for a in gc.get_objects()]).items() if
 c[1] > 4000]
 [(weakref, 5432),
  (wrapper_descriptor, 4162),
  (method_descriptor, 6241),
  (function, 30547),
  (list, 26843),
  (tuple, 10281),
  (dict, 9481)]
 }}}
 and with the patch:
 {{{
 sage: import gc
 sage: from collections import Counter
 sage: %time for n in [1..5000]: x=(matrix(Integers(n),2,2,1))
 CPU times: user 12.8 s, sys: 109 ms, total: 13 s
 Wall time: 13 s
 sage: gc.collect()
 1496
 sage: [c for c in Counter([type(a) for a in gc.get_objects()]).items() if
 c[1] > 4000]
 [(sage.rings.finite_rings.integer_mod.Int_to_IntegerMod, 5001),
  (sage.rings.finite_rings.integer_mod.IntegerMod_int, 138255),
  (sage.rings.finite_rings.integer_mod.NativeIntStruct, 5001),
  (sage.structure.coerce_dict.MonoDict, 20412),
  (sage.rings.ideal.Ideal_pid, 5001),
  (sage.categories.homset.Homset_with_category, 5040),
  (cell, 73146),
  (instancemethod, 10387),
  (wrapper_descriptor, 4160),
  (method_descriptor, 6395),
  (sage.misc.cachefunc.CachedMethodCallerNoArgs, 40956),
  (sage.misc.cachefunc.CachedMethodCaller, 30124),
  (staticmethod, 36521),
  (function, 64203),
  (list, 107010),
  (dict, 120792),
  (builtin_function_or_method, 32639),
  (tuple, 338430),
  (weakref, 71075),
 (sage.rings.finite_rings.integer_mod_ring.IntegerModRing_generic_with_category,
   4331),
  (sage.structure.dynamic_class.DynamicClasscallMetaclass, 35867),
  (sage.structure.coerce_dict.TripleDictEraser, 10180),
  (sage.structure.coerce_dict.MonoDictEraser, 20412),
  (sage.structure.coerce_dict.TripleDict, 10180),
  (weakref.KeyedRef, 86907),
  (frozenset, 30790)]
 }}}
 As you can see, much slower execution and much leakier behaviour (even
 without the patch this kind of stuff is very liable to leak but as you can
 see, this patch makes it much worse)

--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:571>
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