250 000 of 4x4 rects gives 4 000 000 pixels to draw.
250 000 of 200x200 rects gives 10 000 000 000 pixels.
It has to take a lot of time to draw it, unless you reduce the number of rectangles (for example by throwing away the occluded ones).
Try this on your computer:Qt Code:
int main() { for( long long i = 0; i < 10000000000; ++i ); return 0; }To copy to clipboard, switch view to plain text mode(just don't cheat by turning on the optimization).$ time ./a.out
real 0m30.870s
user 0m30.698s
sys 0m0.140s
It takes 30 seconds on my computer just to count from 0 to 999 999 999 --- without any function calls or data manipulation.
BSP won't speed up the drawing, it only speeds up the selection of items that have to be drawn. If you have milions of items and only 1% of them is visible, GraphicsView will do its job, if you want to show all of them at once --- it won't help you.
With such large amount of items, you should rather paint on a pixmap and store that pximap in the memory instead of particular items. You can also use a second thread that will do the drawing (in such case you will need a QImage) and the GUI thread would only display the updated pixmaps.





(same code and image size, just increased rects sizes)
Reply With Quote
Bookmarks