~roguescholar/boost/+git/python:svn-branches/pdimov_pre_136

Last commit made on 2008-07-12
Get this branch:
git clone -b svn-branches/pdimov_pre_136 https://git.launchpad.net/~roguescholar/boost/+git/python

Branch merges

Branch information

Name:
svn-branches/pdimov_pre_136
Repository:
lp:~roguescholar/boost/+git/python

Recent commits

8c014d2... by Peter Dimov <email address hidden>

Save state before 1.36 merges.

[SVN r47337]

c44100a... by DaveAbrahams

Make valid HTML

[SVN r46844]

1dee81d... by Joel de Guzman <email address hidden>

added note on removing targets

[SVN r46817]

8013262... by Beman Dawes

With his kind permission, change Jaakko "Järvi" to "Jarvi"

[SVN r46808]

98f20f3... by DaveAbrahams

Compatibility with Apache STDCXX library. Don't assume eh.h comes along with the other headers automatically.

[SVN r46721]

b01e0e6... by =?utf-8?q?Markus_Sch=C3=B6pflin?= <email address hidden>

Added missing ostream header file.

[SVN r46115]

b0a9b11... by "Ralf W. Grosse-Kunstleve" <email address hidden>

Projects using Boost.Python: PolyBoRi (text provided by Michael Brickenstein)

[SVN r45920]

304277b... by "Ralf W. Grosse-Kunstleve" <email address hidden>

See Python C++-SIG thread: "object.attr(object& attrname) proposal"
Started 2008-05-25 by <email address hidden>.

Excerpts:

If char const* is passed to objecjt.attr(), it uses
PyObject_GetAttrStrng() or PyObject_SetAttrStrng(). If object is
passed to objecjt.attr(), it takes the object as a Python string
object and uses PyObject_GetAttr() or PyObject_SetAttr().

If attr() behaves like this, it can be useful when there are lots
of objects which you know have the same attribute name. You can save
time by first making a boost::python::object and passing it to every
object's attr() inside a loop.

I just made a bit of modification to boost:python locally and did a
quick test, like

test 1:
  for(int i = 0; i < n; ++i)
  {
    omain.attr(attrname) = 444; //attrname is a char const*
  }

test 2:
  for(int i = 0; i < n; ++i)
  {
    object o = omain.attr(attrname); //attrname is a char const*
  }

test 3:
  for(int i = 0; i < n; ++i)
  {
    omain.attr(oaaaa) = 444; //oaaaa is boost::python::object that represents a string
  }

test 4:
  for(int i = 0; i < n; ++i)
  {
    object o = omain.attr(oaaaa); //oaaaa is boost::python::object that represents a string
  }

and it reasonably reflected the difference between PyObject_*Attr() and PyObject_*AttrString.

test 1 :2783ms
test 2 :2357ms
test 3 :1882ms
test 4 :1267ms

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.

[SVN r45918]

a334649... by "Ralf W. Grosse-Kunstleve" <email address hidden>

braces added to resolve g++ 4.3.0 warning

[SVN r45359]

79b7f88... by Daniel James <email address hidden>

Quote href values - our tools don't support unquoted values.

[SVN r45283]