On Monday, December 1, 2014 10:44:44 AM UTC-8, Simon King wrote: > > Is it clear why their not freed, even though UniqueRepresentation only > puts a *weak* reference to them (it uses a weak value dictionary)? >
I don't think it's a memory *leaking* issue this time. My impression is that they're running into POSets being slow for the same reason why computations with polynomials over ZZ would be slow if they were UniqueRepresentation. They are not using POSets as parents--they are using them as elements. So all the parent-specific stuff is wasted time and I don't think it's surprising that this ends up being measurable. Parent creation should be happen a couple of orders of magnitude less frequently than your inner loop computations. > In any case, it is possible to explicitly clear the cache of a > UniqueRepresentation. But this would only help if there is a strong > reference > pointing from the dictionary key to the corresponding item. > Yes it is possible but it should absolutely not be recommended! You're clearing a global cache, so you could be ruining other code that already created an object of the type for which you cleared the cache, and it might be expecting to get a link to the identical object by recreating it with equal parameters. By clearing the cache you might have ruined that. As a last resort in application code you could do it, but it's absolutely not acceptable in library code. Nathann and Jori are working on a ticket, so I think they're aiming to have their code included in the library at some point. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.