On 5/25/08, Robert Bradshaw <[EMAIL PROTECTED]> wrote:
> I'm not quite sure I follow. Where is the cache (is it global, or
>  attached to L, or to the class of L?) What if you write "L.append =
>  len" inside the loop?

It is a static, global, fixed size array, see yourself:

struct method_cache_entry {
        unsigned int version;
        PyObject *name; /* reference to exactly a str or None */
        PyObject *value;        /* borrowed */
};

static struct
method_cache_entry method_cache[1 << MCACHE_SIZE_EXP];

the 'version' field in the entries, plus specials flags and a new
field added to the type object structure are used to determine the
validity of the cache... is not so easy to explain in words... Being
global, you can expect oscure bugs ;-), specially if you play with
tp_dict, as Cython does...

-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to