[Qt-interest] Best way to update 10^5 items

Jorg.Schummer at tieto.com Jorg.Schummer at tieto.com
Tue Sep 29 16:21:54 CEST 2009


Hello!

> I have a huge graphics scene that contains about 100.000
> individual items (Ellipses, squares) whose colors are
> regularly updated.
>
> My problem is now, that updating the colors takes quite a
> long time (10 seconds on a quite fast machine). Is there a
> way to improve the speed or do I have to live with it? Here
> the (Python) code that takes so long (mydata is an array that
> holds the colors, myitems is the list that holds the items)
> -----------------------------8<---------------------------------
> #
> # This takes a long time.
> #
> for gray, item in zip(mydata, myitems):
>     item.brush().color().setRgb(gray, gray, gray)
>

So how long would the execution of the following take on your machine?

for gray, item in zip(mydata, myitems):
    do_nothing()

In other words: Are you sure python is not the (/not a) bottleneck?

Jörg




More information about the Qt-interest-old mailing list