|
Boost Users : |
Subject: Re: [Boost-users] Boost Python is slow?
From: Tyomich on the AIR (cadchrk_at_[hidden])
Date: 2009-07-13 00:34:31
> Boost.Python is a little slower than wrapping directly using Python C-API,
> especially in very simple cases like yours. (It is a variant of the
> abstraction penalty.) However, it is hard to believe that it is 4x slower.
> Would you mind posting complete compilable examples so that we can take a look
> at it?
> Regards,
> Ravi
Sure! Here they are: http://www.filefactory.com/file/ahda0d8/n/_export_Boost_vs_pure_Python_7z
I tried to get/set and increase the member of a struct and here are my results:
Getting boost.python point 1000000 times:
0.30395876051
Getting Python point 1000000 times:
0.096010029312
Setting boost.python point 1000000 times:
0.373980616451
Setting Python point 1000000 times:
0.109051436823
Increasing boost.python point 1000000 times:
0.708493801882
Increasing Python point 1000000 times:
0.20538183019
The numbers are time in seconds taken to accomplish calculations. As you can see, Boost.Python is apparently 3-4 times slower than its equivalent in pure Python.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net