[Kde-bindings] playground/bindings/kimono

Richard Dale rdale at foton.es
Wed Mar 21 10:36:13 UTC 2007

On Tuesday 20 March 2007, Arno Rehn wrote:
> SVN commit 644738 by arnorehn:
> * Made instance operators work
OK good this is quite simple to implement. I wasn't sure that checking for 
operator methods with one arg was a good way of telling if it was an instance 
method, but it seems there aren't really any static ones with one arg and it 
does work:

rbqtapi -roperator | grep static |grep -v ','
        static const QPoint QGlobalSpace::operator-(const QPoint&)
        static const QPointF QGlobalSpace::operator-(const QPointF&)

But when I ran my 'performance test' which consists of starting tutorial t14, 
setting the force to 40 and firing a shot while watching the cpu consumption 
with top, I noticed it uses quite a bit more with this change. Up to 38% of 
cpu from about 22% before. I changed the code to set a boolean to save the 
value of the test to avoid doing it twice per method call. Then I tried 
duplicating the IsInstanceOperator call so it was tested 5 times and found 
that t14 ran with about twice the cpu load as with no calls at all. So it 
looks like there is quite a big overhead per method call.

I think it would be quicker and easier to special case these methods on the 
C/C++ side. Then we would probably only need to do a string comparison on the 
method name, and rearranging the smoke stack is easier there too.

-- Richard

-------------- next part --------------
A non-text attachment was scrubbed...
Name: is_operator.patch
Type: text/x-diff
Size: 1026 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20070321/07274d4d/attachment.bin>

More information about the Kde-bindings mailing list