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. How to optimize Qt apps if RtlUserThreadStart is the bottleneck

How to optimize Qt apps if RtlUserThreadStart is the bottleneck

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.2k Views
  • 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.
  • thamT Offline
    thamT Offline
    tham
    wrote on last edited by tham
    #1

    Developing a computer vision app by Qt5.9.4, every computer vision operations, streaming encoding/decoding/fetching are done in another thread. The frame hang temporarily when I send the information to the server from times to times(all of the network operations are put in another thread, it need to encode image to jpg and generate json).

    Using Very Sleepy as profiler to find out the bottleneck(this app use a lot of gpu power, I only use sleepy to measure the cpu cost)

    screenshot of the results

    Note : Figure out the freezing issue is caused by the data insertion of sqlite(operate at main thread), but the most costly function call are related to multi-thread, although optimize sqlite data insert part should solve the issue, I would like to know how could I reduce time consuming by RtlUserThreadStart and another time consuming function calls, thanks

    aha_1980A 1 Reply Last reply
    0
    • thamT tham

      Developing a computer vision app by Qt5.9.4, every computer vision operations, streaming encoding/decoding/fetching are done in another thread. The frame hang temporarily when I send the information to the server from times to times(all of the network operations are put in another thread, it need to encode image to jpg and generate json).

      Using Very Sleepy as profiler to find out the bottleneck(this app use a lot of gpu power, I only use sleepy to measure the cpu cost)

      screenshot of the results

      Note : Figure out the freezing issue is caused by the data insertion of sqlite(operate at main thread), but the most costly function call are related to multi-thread, although optimize sqlite data insert part should solve the issue, I would like to know how could I reduce time consuming by RtlUserThreadStart and another time consuming function calls, thanks

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi @tham,

      You will need to explain a bit more how your program works. Till then I can only guess:

      Do you start a lot of new threads? Do you start a new thread for every image that is to encode? Then you might be better of having one permanently running thread that gets a new picture e.g. by a signal and then does the processing.

      Regards

      Qt has to stay free or it will die.

      thamT 1 Reply Last reply
      3
      • aha_1980A aha_1980

        Hi @tham,

        You will need to explain a bit more how your program works. Till then I can only guess:

        Do you start a lot of new threads? Do you start a new thread for every image that is to encode? Then you might be better of having one permanently running thread that gets a new picture e.g. by a signal and then does the processing.

        Regards

        thamT Offline
        thamT Offline
        tham
        wrote on last edited by tham
        #3

        @aha_1980

        Do you start a lot of new threads? Do you start a new thread for every image that is to encode

        Every thread only initialize once, they run as permanently thread until the app/camera closed.

        Edit : The computer vision part, do use a lot of sleep call, change it to wait condition may improve performance, but do it worth the trouble?

        aha_1980A 1 Reply Last reply
        0
        • thamT tham

          @aha_1980

          Do you start a lot of new threads? Do you start a new thread for every image that is to encode

          Every thread only initialize once, they run as permanently thread until the app/camera closed.

          Edit : The computer vision part, do use a lot of sleep call, change it to wait condition may improve performance, but do it worth the trouble?

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          hi @tham

          you should investigate a bit yourself why this API function sums up to 800 seconds and if that is critical.

          e.g. WaitForMultipleObjects is not as it suspends you thread waiting for data (which is perfectly Ok)

          Qt has to stay free or it will die.

          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