[Qt-interest] Best way to update 10^5 items
Ole Streicher
ole-usenet-spam at gmx.net
Tue Sep 29 16:57:10 CEST 2009
Hi Oliver,
<Oliver.Knoll at comit.ch> writes:
> Ole Streicher wrote on Tuesday, September 29, 2009 4:08 PM:
>
>> Hi,
>>
>> I have a huge graphics scene that contains about 100.000 individual
>> items (Ellipses, squares) whose colors are regularly updated.
>
> Typically you don't need to update *all* objects; unless they are
> about 4x4 pixels in size and fill an entire 1680 x 1024 screen
> (roughly ;) without overlapping each other.
The objects represent channels of some device; I have about 100.000 of
them. Usually they are rectangular, about 2x2 in size and all
visible. But, some may have other sizes and/or other shapes (cirles).
> So your problem is the typical graphic scenario: "Which objects are
> actually visible on the screen?" Or in other words: "Which objects do
> I actually have to *really* re-paint?"
All. Thats the problem.
> Once you have decided which objects are actually visible you can gain
> even more performance by *simplifying* your objects. For exampe, an
> ellipse which would end up as being rendered as a 4 x 4 pixel small
> object, why not "approximate" it with a simple rectangle?
They are already rectangles.
> And if it becomes even smalller, why not just draw a dot?
Since the view is zoomable: how can I do this?
> Turn off anti-aliasing for small objects,
Is turned off generally.
> don't draw contour lines
The pen is set to NoPen. Is this what you mean?
> etc. etc.
> Actually the Qt "Chips" graphic demo makes use of exactly these
> techniques, study its code. :) (It "only" deals with 40'000 objects -
> but then again, those "chips" are probably more complex than your
> rectangles and ellipses. Anyway, the same techniques apply ;)
This was my starting point and the reason that I decided to use
QGraphicsScene for my implementation. However, it looks quite slow in my
case.
Best regards
Ole
More information about the Qt-interest-old
mailing list