Hello,

Promped by an off-list mail by Tomas, I went to investigate how big a
Deferred object really is.

I tried doing

>>> a = [Deferred() for _ in xrange(10**5)
>>> b = [Deferred() for _ in xrange(10**5)

and so on in an interactive Python session and observed the memory usage
grow with about 20 MiB per list. This means that an empty Deferred
occupies about 210 bytes in memory.

Adding a callback right away:

>>> a = [Deferred().addCallback(foo) for _ in xrange(10**5)]

increases the size per Deferred to about 500 bytes.

I'm not sure what I expected, but half a kilobyte for a Deferred is
quite a lot.

The Twisted folks are working on a C implementation of
twisted.internet.defer, and that might help -- I don't know. The
discussion is here:

  http://twistedmatrix.com/trac/ticket/2245

-- 
Martin Geisler

Attachment: pgpgysla5EdDo.pgp
Description: PGP signature

_______________________________________________
viff-devel mailing list (http://viff.dk/)
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk

Reply via email to