[Interest] How to speed-up chameleons

igor.mironchik at gmail.com igor.mironchik at gmail.com
Mon Jun 9 03:40:23 CEST 2014


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/20140609/9a565fc1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Chameleon.zip
Type: application/octet-stream
Size: 4118 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140609/9a565fc1/attachment.obj>


More information about the Interest mailing list