Message157860
| Author |
loewis |
| Recipients |
loewis, mark.dickinson, pitrou, skrah |
| Date |
2012年04月09日.16:30:24 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<20120409183023.Horde.sab-ANjz9kRPgw6f8dfCS7A@webmail.df.eu> |
| In-reply-to |
<1333988067.75.0.775317539337.issue14520@psf.upfronthosting.co.za> |
| Content |
> In the C version of decimal, do distinct Decimal objects ever share
> coefficients? (This would be an obvious optimization for methods
> like Decimal.copy_negate; I don't know whether the C version
> applies such optimizations.) If there's potential for shared
> coefficients, that might make the "not count any memory twice" part
> tricky.
I know of three strategies to deal with such a case:
a) expose the inner objects, preferably through tp_traverse, and
don't account for them in the container,
b) find a "canonical" owner of the contained objects, and only
account for them along with the canonical container.
c) compute the number N of shared owners, and divide the object
size by N. Due to rounding, this may be somewhat incorrect. |
|