#15367: Empty lists while creating parents
---------------------------+-------------------------
       Reporter:  roed     |        Owner:
           Type:  defect   |       Status:  new
       Priority:  major    |    Milestone:  sage-5.13
      Component:  memleak  |   Resolution:
       Keywords:           |    Merged in:
        Authors:           |    Reviewers:
Report Upstream:  N/A      |  Work issues:
         Branch:           |       Commit:
   Dependencies:           |     Stopgaps:
---------------------------+-------------------------

Comment (by nbruin):

 Replying to [comment:10 SimonKing]:

 > Do I understand correctly: Your suggestion is to start with a list (an
 actual initialised list) of buckets, but initially each bucket will be
 `None` rather than `[]`.

 Uh, no. I was more thinking of starting out with a bucket ''list'' of
 None. Your interpretation is also possible, but addresses a slightly
 different issue. It could be worth doing both, one of the two, or neither.

 For your proposal: I don't know what the cost difference is between making
 an empty list and putting another reference to None in, i.e., the cost of
 {{{
    cdef PyList buckets = PyList_New(nbuckets)
    for i in range(nbuckets):
         PyList_SetItem(buckets,i,None) #I think this works OK for
 refcounting
 }}}
 versus
 {{{
    cdef PyList buckets = PyList_New(nbuckets)
    for i in range(nbuckets):
         PyList_SetItem(buckets,i,PyList_New(0))
 }}}
 If the difference is significant (and it may well be, because increffing
 doesn't involve memory allocation) then your interpretation may well have
 great benefits (and surely reduced memory footprint).

 If you're feeling gutsy, you could just leave the entries in `buckets`
 initialized with `NULL` and save on all the incref/decref activity on
 None.

 Come to think of it, I expect that your interpretation would have the
 biggest impact.

--
Ticket URL: <http://trac.sagemath.org/ticket/15367#comment:11>
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/groups/opt_out.

Reply via email to