Message187516
| Author |
pitrou |
| Recipients |
alexandre.vassalotti, asvetlov, pitrou, serhiy.storchaka |
| Date |
2013年04月21日.17:19:05 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1366564742.2543.6.camel@fsol> |
| In-reply-to |
<1366560970.44.0.278349507425.issue17810@psf.upfronthosting.co.za> |
| Content |
> Memoization consumes memory during pickling. For now every memoized
> object requires memory for:
>
> dict's entity;
> an id() integer object;
> a 2-element tuple;
> a pickle's index (an integer object).
>
> It's about 80 bytes on 32-bit platform (and twice as this on 64-bit).
As far as I understand, Alexandre doesn't propose to suppress
memoization, only to make it implicit. Therefore the memory overhead
would be the same (but the pickle would have less opcodes).
> For data which contains a lot of floats it can be cumbersome.
Apparently, floats don't get memoized:
>>> pickletools.dis(pickle.dumps([1.0, 2.0]))
0: \x80 PROTO 3
2: ] EMPTY_LIST
3: q BINPUT 0
5: ( MARK
6: G BINFLOAT 1.0
15: G BINFLOAT 2.0
24: e APPENDS (MARK at 5)
25: . STOP |
|