[Interest] How to speed-up chameleons

igor.mironchik at gmail.com igor.mironchik at gmail.com
Wed Jun 11 16:21:43 CEST 2014


Hi guys,

I have one question to you. Why new syntax of QObject::connect() improve performance for a 5%.

I mean that if in code change

connect( sender, SIGNAL( signal() ), receiver, SLOT( slot() ) );

to

connect( sender, &Sender::signal, receiver, &Receiver::slot );

then code works faster... Why? May be somebody know the answer, I don’t want to read Qt’s code for the answer on this question.

Thanks.

From: igor.mironchik at gmail.com 
Sent: Monday, June 09, 2014 8:08 AM
To: interest at qt-project.org 
Subject: Re: How to speed-up chameleons

Sorry guys, but in the code was error.

But this error did not affect the performance.

In the attachment code without error...

From: igor.mironchik at gmail.com 
Sent: Monday, June 09, 2014 3:40 AM
To: interest at qt-project.org 
Subject: How to speed-up chameleons

Hi. I did a comparison of Qt with another framework (SObjectizer). For this I used a task named “Chameleons”:

* Need to create four competitive (in the sense of each lives in its own thread) chameleons of different colors (blue, red, yellow, blue);

* Each chameleon should regularly come to the venue and meet there with another chameleon. If a place of meeting, there is no one who comes first chameleon should wait a second;

* At the meeting should be appropriately chameleons change their color. When calculating the new color chameleon can not use arithmetic - only if / else, switch / case or pattern-matching;

* After the on-site meeting formed N pairs, each chameleon should "dry up" (get a special color FADED), report the number of chameleons met them personally and to complete its work.

As a result of the work program should print the amount reported by each chameleon meetings. For example, for N = 100 the result of the program should be 200.

The result is terrible. Qt is 10 times slower.

In the attachment you can find my implementation of this task on Qt.

And my question is how to speed-up it?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140611/e84c7095/attachment.html>


More information about the Interest mailing list