Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Performance Question
Forum Updated to NodeBB v4.3 + New Features

Performance Question

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 816 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    visinet
    wrote on last edited by
    #1

    I just started playing with QT in my quest to find a replacement for my Borland C++ Builder and and wanted to do a quick performance test between it, C# and Java in updating a bunch of buttons on a form. Basically I have a form with 200 buttons and a timer. When the timer goes off every 500ms I loop through all the buttons on the form and change the background color between RED and BLUE so they blink every half second. I use and elapsed timer in the Timer event mentioned above to time how long it takes to loop through all the controls and change their background colors. I have done basically the exact same thing in both C# and a Java swing app and the results I am seeing are not what I expected. Visually, the QT app looks the fastest, in that all the buttons change color in sync without any impression of lag, while in the C# and Java apps the buttons appear to be out of sync due to time required to redraw each and every button. This is what I would expect to see from good old C++ vs interpreted language such as c# and java. However, the time that is being reported by the elapsed timer in QT, and equivalent methods in C# and Java are the exact opposite. The QT code is taking about 90ms where both the C# and Java are taking like .5ms. Yes, that is .5ms and not a typo. Not only is that is a massive difference, but I would expect QT to be reporting the faster times, not 100X slower.

    Can anyone maybe shed some light on this for me? Am I doing something stupid? Is this a rare case, or should I not be surprised to see similar kinds of results when looking at graphics related stuff like this.

    Thanks a bunch for any help on this.

    Visinet

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi, and welcome to the Qt Dev Net!

      I don't know how the C# and Java functions behave, but I'm guessing that they're asynchronous (the functions return before they the colour is fully updated), while the Qt function is synchronous (the function waits until the colour is fully updated before returning).

      If my guess is correct, then you're not actually measuring the time taken to update the colours in C# and Java.

      By the way, how do you change the colour of the Qt buttons?

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • V Offline
        V Offline
        visinet
        wrote on last edited by
        #3

        I was wondering if it was something like that where the call in QT was blocking. Do you know for sure if it is synchronous? What about other window elements? Is anything that operates on windows controls going to be synchronous? If so, I wouldn't think that would be a very ideal implementation. How could you keep a program responsive when a lot of this type of stuff needs to be done? The only way I could find to change the color was to call setStyleSheet for each button so that is how I am doing it.

        Thanks

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved