Results 1 to 20 of 72

Thread: QGraphicsScene/QGraphicsView performance problems

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QGraphicsScene/QGraphicsView performance problems

    I made my own experiments. With about 0.5M items the application was using about 80 megabytes of memory which gives an average of 160 bytes per item (including the memory used by all other components) which I think is not that bad. At that point the application was responsive although very slow. The slowdown is caused by the fact that even if I intend not to draw some item, the matrix still has to be produced and applied for each of them. Making the architecture ignore items that are sure not to be drawn would speed the app significantly.

    See attached the code I used.
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2008
    Posts
    155
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: QGraphicsScene/QGraphicsView performance problems

    Quote Originally Posted by wysota View Post
    I made my own experiments. With about 0.5M items the application was using about 80 megabytes of memory which gives an average of 160 bytes per item (including the memory used by all other components) which I think is not that bad. At that point the application was responsive although very slow. The slowdown is caused by the fact that even if I intend not to draw some item, the matrix still has to be produced and applied for each of them. Making the architecture ignore items that are sure not to be drawn would speed the app significantly.
    Will this be someting for a future Qt release?
    See attached the code I used.
    I will study the code, I will probably learn a lot from it. Thanks!
    MacOSX user dabbling with Linux and Windows.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QGraphicsScene/QGraphicsView performance problems

    Quote Originally Posted by bnilsson View Post
    Will this be someting for a future Qt release?
    I don't think Andreas' team has such plans You'd have to implement it yourself by reimplementing drawItems() in the scene (I think).

  4. #4
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    37
    Thanked 53 Times in 40 Posts

    Default Re: QGraphicsScene/QGraphicsView performance problems

    Quote Originally Posted by wysota View Post
    Making the architecture ignore items that are sure not to be drawn would speed the app significantly.
    Is it true ? or did i misunderstand ?
    I was under impression that GV framework doesn't draw items not visible on viewport (ofcourse i dont mean hidden items)
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QGraphicsScene/QGraphicsView performance problems

    Quote Originally Posted by Gopala Krishna View Post
    I was under impression that GV framework doesn't draw items not visible on viewport (ofcourse i dont mean hidden items)
    Take a look at my code. I'm deciding whether to draw something or not based on the distance between the object and the camera (level of detail). If something is very far away (but still inside the camera's viewport) I decide not to draw it, but the whole painting environment is set up by the architecture anyway.

Similar Threads

  1. Performance problems with overlapping qgraphicsitems
    By brjames in forum Qt Programming
    Replies: 13
    Last Post: 4th May 2008, 21:42
  2. Poor performance with Qt 4.3 and Microsoft SQL Server
    By Korgen in forum Qt Programming
    Replies: 2
    Last Post: 23rd November 2007, 10:28
  3. GraphicsView performance problems
    By Gopala Krishna in forum Qt Programming
    Replies: 79
    Last Post: 8th August 2007, 17:32
  4. Replies: 2
    Last Post: 8th March 2007, 22:22
  5. Replies: 1
    Last Post: 4th October 2006, 16:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.