Just out of curiosity, what is the impact on speed?
>
> Best regards,
> Simon
>
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
* Should I modify my weak version of
`sage.structure.coerce_dict.TripleDict` so that strong references are
used in the first place, but so that the oldest references are
"weakened" when the dictionary grows bigger than a certain threshold?
That is likely to fix the example above and other types of examples as
well, but may create an overhead.
+1 to the ring buffer idea as well. Though not as complete, it could
be reasonably large and still prevent memory leaks. In terms of
performance, I wonder if sage/schemes does a lot of large, external
operations (e.g. pari or factoring or non-coercion-requiring
arithmetic). What's the slowdown for ZZ * RDF for this patch?
- Robert
Both, but primarily the latter. It's a microbenchmark, but loop like
a = Integer(10)
b = QQ(20)
s = RDF(30)
for x in range(10**n):
s += a*b*x
should give us an upper bound on how expensive any changes could be.
(And yes, people write code like this...) Maybe a similar test with a
tower of small finite fields. The impact could be greater for more
complicated rings, but the relative impact probably smaller.
- Robert