Martin Geisler <[EMAIL PROTECTED]> writes:

> [...] This means that an empty Deferred occupies about 210 bytes in
> memory. Adding a callback right away [...] increases the size per
> Deferred to about 500 bytes.

Looking at the definition of the Deferred class one sees that it is
quite simple:

  class Deferred:
      called = 0
      paused = 0
      timeoutCall = None
      _debugInfo = None
      debug = False

      def __init__(self):
          self.callbacks = []

      # ... lots of methods ...

Counting 4 bytes for the integers (called, paused), 4 bytes for the
object references (timeoutCall, _debugInfo, callbacks), 1 byte for the
boolean (debug) I get this to be about 21 bytes.

But to this we must add quite a lot of overhead as explained here:

  http://groups.google.dk/group/comp.lang.python/msg/4e0f9800c5898334

Using the heuristic there, an integer takes up 32 bytes and an empty
list takes up 40 bytes! Ugh...

-- 
Martin Geisler
_______________________________________________
viff-devel mailing list (http://viff.dk/)
viff-devel@viff.dk
http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk

Reply via email to