[C++-sig] object.attr(object& attrname) proposal

hohe2 hohe hohehohe2 at gmail.com
Mon May 26 06:56:10 CEST 2008


Hi Ralf,

> Hi Koichi,
> The patch looks OK to me. If you'd like this included in the main version,
> please also supply test and doc patches (probably
libs/python/test/object.cpp
> and libs/python/doc/v2/object.html).
Sure!
I'll post it here when I've done it.

> Out of curiosity: did you also time calling PyObject_G/SetAttr() directly?
> How much of a difference does that make?
Yes I did several other tests together with the last ones,

    test5: PyObject_SetAttrString(po_main, "aaaa", po_num444);
    test6: Py_DECREF(PyObject_GetAttrString(po_main, "aaaa"));
    test7: PyObject_SetAttr(po_main, po_aaaa, po_num444);
    test8: Py_DECREF(PyObject_GetAttr(po_main, po_aaaa));
    (po_ prefixed variables are PyObject*),

all inside each for loop, and the results were

test 5 :2410ms
test 6 :2277ms
test 7 :1629ms
test 8 :1094ms

It's boost 1.35.0, Python 2.5 on linux(gcc4.1.2).
I also did the same test on windows(vs8) and the tendency was not so
different.

- Koichi

> Hi Koichi,
> The patch looks OK to me. If you'd like this included in the main version,
> please also supply test and doc patches (probably
libs/python/test/object.cpp
> and libs/python/doc/v2/object.html).
> Out of curiosity: did you also time calling PyObject_G/SetAttr() directly?
> How much of a difference does that make?
> Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080526/8bbfa60d/attachment.htm>


More information about the Cplusplus-sig mailing list